Skip to main content

Argo CD | The adoption of GitOps is skyrocketing due to its ability to enhance the development and delivery of software applications.

It revolutionizes software operations by empowering development teams to declaratively manage code and infrastructure using a Git repository as the ultimate source of truth. An orchestration system like Kubernetes plays a vital role in this setup, enabling GitOps to work seamlessly and implement infrastructure-as-code (IaC).

However, managing applications on Kubernetes can be arduous and may require advanced skills. To overcome this complexity, the deployment of applications using Kubernetes and the Continuous Integration Continuous Deployment (CI/CD) process provides an abstraction layer.

Introducing Argo CD

Argo CD is an open-source GitOps tool designed for Kubernetes applications, emphasizing a declarative and continuous delivery approach.

Argo CD gitops Kubernetes

Hosted by the Cloud Native Computing Foundation (CNCF), Argo CD leverages the GitOps model, making Git repositories the single source of truth for the state of Kubernetes infrastructure.

It continually monitors running applications, clusters, and declaratively defined infrastructure, ensuring that the live and desired states match, as defined in Git. It automatically addresses any discrepancies, effectively automating application deployment.

Why Choose Argo CD?

When it comes to implementing a well-considered GitOps approach, Argo CD and Kubernetes prove to be an excellent combination. Let’s explore some key reasons why Argo CD stands out:

Continuous Delivery On Kubernetes With GitOps Argo CD

Streamlined Software Delivery with GitOps: Argo CD effortlessly synchronizes application configuration with the current state declared in Git. It diligently tracks any changes made in Git, ensuring a seamless development workflow.

Automated Kubernetes Deployment: Argo CD offers deployment capabilities across various clusters, whether they reside in an on-premises data center or a public cloud platform like AWS, GCP, or Azure.

Efficient Deployment Strategies: With Argo CD, you can easily roll back applications to any previous version stored in Git. Integration with tools like Spinnaker or Argo Rollouts enables the implementation of efficient deployment strategies like Blue-Green and Canary releases.

Detect Deployment Issues: Argo CD has the potential to detect deployment issues and remediate configuration drift in your applications, ensuring a stable and reliable environment.

RBAC and Multitenancy: Argo CD provides role-based access control (RBAC), allowing you to manage authorization for specific clusters and services. This feature is particularly valuable for DevOps teams working on large clusters, enabling them to apply read/write restrictions as needed.

CLI and Web User Interface: Argo CD offers a command-line interface (CLI) and a web user interface to configure and receive real-time updates on application deployments, providing flexibility and convenience for managing your applications.

Extensive Compatibility: Argo CD supports various configuration management and templating tools such as Helm charts, Kustomize, YAML, and Jsonnet. It also integrates seamlessly with webhooks from popular Git hosting platforms like BitBucket, GitHub, and GitLab.

Prerequisites for Argo CD

  1. Before getting started with Argo CD, ensure you have the following prerequisites in place:
  2. Install and set up the kubectl command-line tool. Refer to the official documentation for installation instructions.
  3. Prepare a kubeconfig file to access your Kubernetes cluster.
  4. Set up a Git repository for your GitOps workflow.
  5. Install Argo CD by following the installation guide provided by the project.
  6. Configure and set up the desired Kubernetes clusters, whether on GKE or EKS, based on your requirements.

Supported Manifest Formats

Argo CD supports various manifest formats in your GitOps repository. According to the documentation, it can handle the following formats:

  • Kustomize applications
  • Helm charts
  • Ksonnet applications
  • A directory of YAML/JSON manifests, including Jsonnet
  • Any custom configuration management tool configured as a config management plugin

For the purpose of this tutorial, the only prerequisite is access to a Kubernetes cluster. You can utilize Minikube or Kind to set up a one-node cluster for testing and learning purposes.

Let’s walk through the steps to install and use Argo CD:

1. Creating the Namespace
To begin, create a namespace for Argo CD using the following command:

$ kubectl create namespace argocd

2. Applying the Manifest File
Apply the manifest file to the created namespace using the following command:

$ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

This command will ensure that the necessary components are deployed within the argocd namespace.

3. Verifying Pod Status
Check that all pods are running correctly within the argocd namespace:

$ kubectl get pods -n argocd

This command will display the status of the pods, ensuring that they are up and running.

4. Exposing the Argo CD Server UI
To access the Argo CD server UI, you need to forward the port using the following command:

$ kubectl port-forward svc/argocd-server -n argocd 8080:443

You can choose any available port for forwarding.

Once the port forwarding is successful, you can access the Argo CD UI at https://localhost:8080/.

5. Logging in to Argo CD
To log in to Argo CD, you need a username and password. The default username is ‘admin’. Use the following command to generate the password:

$ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

The output will display the password, which you can use to log in to Argo CD.

6. Deploying an Application via Helm to Argo CD
To deploy an application to Argo CD using Helm, you can utilize the Argo CD example repository available at https://github.com/argoproj/argocd-example-apps. Follow the repository’s instructions to deploy a guestbook application.

7. Creating an Application on Argo CD
Use the following command to create an application named ‘helm-guestbook’ on Argo CD, pointing to the example repository:

$ argocd app create helm-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path helm-guestbook --dest-server https://kubernetes.default.svc --dest-namespace argocd

This command will create the application within Argo CD.

8. Checking the Application Status
To verify the status of the created application, use the following command:

$ argocd app get helm-guestbook

You can also check the UI dashboard to view the status of the application.

9. Accessing the Deployed Application
To access the deployed application in a browser, set up port forwarding using the following command:

$ kubectl port-forward svc/helm-guestbook 9090:80

Ensure that the port you choose, in this case, 9090, doesn’t conflict with any other services. Open a browser window and navigate to localhost:9090 to see your guestbook application in action.

From this point onward, any future pushes to the associated GitHub repository will automatically trigger updates in Argo CD. The deployments in Argo CD will be synchronized accordingly, ensuring continuous availability of your applications.

That’s it! You have successfully installed and deployed an application using Argo CD on Kubernetes. As Kubernetes involves multiple layers of abstraction, it is crucial to maintain deployability and track every change made. This is precisely where Argo CD aligns perfectly with the GitOps philosophy. Give it a try and share your experience with us.

Conclusion

Remember, Argo CD simplifies the management of Kubernetes applications through declarative and continuous delivery. It automates the synchronization between your Git repositories and the desired state of your applications, ensuring consistent and reliable deployments. With its compatibility with various configuration management tools and its user-friendly interface, Argo CD offers an efficient and streamlined approach to GitOps.

Embrace the power of Argo CD and unlock the potential of GitOps for your Kubernetes deployments. Happy deploying!

Leave a Reply