ArgoCD is a GitOps tool with a straightforward but powerful objective: to declaratively deploy applications to Kubernetes by managing application resources directly from version control systems, such as Git repositories. Every commit to the repository represents a change, which ArgoCD can apply to the Kubernetes cluster either manually or automatically. This approach ensures that deployment processes are fully controlled through version-controlled files, fostering an explicit and auditable release process.
For example, releasing a new application version involves updating the image tag in the resource files and committing the changes to the repository. ArgoCD syncs with the repository and seamlessly deploys the new version to the cluster.
Since ArgoCD itself operates on Kubernetes, it is straightforward to set up and integrates seamlessly with lightweight Kubernetes distributions like K3s. In this tutorial, we will demonstrate how to configure a local Kubernetes cluster using K3D and deploy applications with ArgoCD, utilizing the argocd-example-apps repository as a practical example.
Prerequisites
Before we begin, ensure you have the following installed:
- Docker
- Kubectl
- K3D
- ArgoCD CLI
Step 1: Set Up a K3D Cluster
Create a new Kubernetes cluster using K3D:
Verify that your cluster is running:
Step 2: Install ArgoCD
Install ArgoCD in your K3D cluster:
Check the status of ArgoCD pods:
Expose the ArgoCD API server locally, then try to accessing the dashboard:
Step 3: Configure ArgoCD
Log in to ArgoCD
Retrieve the initial admin password:
Log in using the admin username and the password above.
Connect a Git Repository
Just clone the argocd-example-apps repository:
Specify the ArgoCD server address in your CLI configuration:
Create a new ArgoCD application using the repository:
Sync the application:
Step 4: Verify the Deployment
Check that the application is deployed successfully:
Access the deployed application by exposing it via a NodePort or LoadBalancer:
Conclusion
In this tutorial, you’ve set up a local Kubernetes cluster using K3D and deployed applications with ArgoCD. This setup provides a simple and powerful way to practice GitOps workflows locally. By leveraging tools like ArgoCD, you can ensure your deployments are consistent, auditable, and declarative. Happy GitOps-ing!