• Home
  • Argo CD Kubernetes Guide: Continuous Delivery for Beginners
Argo CD Kubernetes
webbuilder August 25, 2023 0 Comments

Argo CD Kubernetes Guide: Streamlining Continuous Delivery for Beginners

Argo CD Kubernetes automates deploying and managing applications in Kubernetes environments, ensuring consistency and adherence to best practices.  The CD is a methodology that streamlines and automates the steps of releasing new software versions. This could enhance software distribution regarding speed, reliability, and safety.

Continuous delivery for Kubernetes is now easier than ever with Argo CD, an open-source GitOps tool. It keeps an eye on your cluster and your Git repository containing your declaratively described infrastructure and fixes any discrepancies.

This article will show you how to set up a Kubernetes cluster and install Argo CD. We will also review using Argo CD for basic application deployment and management.

This tutorial will show you how to utilize Argo CD to automate and improve your software application deployments and expedite your continuous delivery process.

Argo CD Kubernetes

Step 1. Install Argo CD Kubernetes

The first step in installing Argo CD is to fulfill the prerequisites and create a namespace. Read on for details:

Valid Kubernetes Configuration:

Before installing Argo CD, ensure you have a valid Kubernetes configuration set up with kubectl, allowing you to communicate with your worker nodes. You can test this by running:

kubectl get nodes

Verify that the command returns a list of nodes with the “Ready” status.

Create the Argo CD Namespace:

Establish the argocd namespace in your cluster, which will host Argo CD and its associated services:

kubectl create namespace argocd

Run Argo CD Install Script:

Use the provided Argo CD install script from the project maintainers to initiate the installation:

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

Monitor Pod Status:

After successful installation, monitor the status of your Kubernetes pods using the watch command:

watch kubectl get pods -n argocd

In a standard Argo CD installation, you should see five pods with the “Running” status.

Exit Watch Interface:

You can exit the watch interface by pressing Ctrl+C.

Accessing Argo CD:

While Argo CD is now running in your Kubernetes cluster, you won’t be able to access it directly due to Kubernetes’ network abstractions. Handling this is covered in the next step.

Step 2: Accessing Argo CD API Server

Once Argo CD is successfully installed on your Kubernetes cluster, the next crucial step is to gain access to the Argo CD API server. This server is the gateway to managing your deployments, and accessing it enables you to take full control of your Continuous Delivery workflow. Argo CD provides several techniques to achieve this:

Service Type Load Balancer:

By default, the Argo CD API server might not have an external IP exposed. To address this, consider changing the service type to LoadBalancer using the following command:

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

Ingress:

For a more advanced configuration, refer to the Kubernetes ingress documentation to set up Argo CD with an ingress that suits your requirements.

Port Forwarding:

Port forwarding is a practical method to access the API server without exposing it externally. Execute the following command to forward local port 8080 to the internal port 443 of the argocd-server service:

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

Note: Port forwarding will occupy your terminal, so consider running it in a new terminal window while continuing your work. Press Ctrl+C to stop the port forwarding process gracefully.

Accessing the API Server:

Once port forwarding is active, you can access the Argo CD API server by navigating to https://localhost:8080 in your web browser. Keep in mind that you might encounter a login prompt. The credentials needed to proceed will be obtained using the command line in the subsequent step. Depending on your browser’s security settings, you might encounter a security warning due to the absence of a valid SSL certificate for Argo CD.

With this access established, you’re primed to delve deeper into the intricacies of Argo CD configuration and application deployment in the subsequent steps.

Step 3: Interacting with Argo CD via the Command Line

Effectively working with your Argo CD instance requires interfacing with it through the command line. This step guides you through installing the necessary command line tool, configuring credentials, and performing essential tasks using the argocd command.

Install the argocd Command:

To start, ensure you have the argocd command installed locally. The recommended method is through Homebrew, a versatile package manager available for both MacOS and Linux. If Homebrew isn’t already installed, execute the following command to retrieve and set it up:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once Homebrew is installed, use it to install the argocd command:

brew install argocd

Retrieve Admin Password:

Before using argocd, you need to retrieve the admin password generated during installation. Extract it using the following command:

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

Logging into Argo CD Dashboard:

Access your Argo CD dashboard by visiting localhost:8080 in your web browser. Log in as the admin user using the retrieved password.

Logging in via the Command Line:

Employ the argocd login command to log into Argo CD via the command line. Use the following command and follow the prompts, including the certificate warning:

argocd login localhost:8080

If desired, change your password for enhanced security or memorability using:

argocd account update-password

Using Credentials for Deployment:

The credentials established through the above steps allow you to log in via the command line, a necessity for deploying applications through Argo CD.

By configuring the command line interface, you’ve established a direct channel to interact with your Argo CD instance, setting the stage for more advanced operations and application deployments in subsequent steps.

Step 4: Enabling Cross-Cluster Deployment (Optional)

In scenarios where deploying applications across multiple clusters is essential, Argo CD empowers you to manage this complexity efficiently. This step provides insights into how you can handle cross-cluster deployments, ensuring your applications find their home in the right environment.

Understanding Cross-Cluster Deployment:

By default, Argo CD deploys applications to the same cluster where it’s installed. However, for real-world scenarios, you might need to target different clusters for specific deployments. This segregation prevents mixing production and testing workloads, maintaining a more controlled deployment environment.

Listing Known Clusters:

To comprehend your available cluster options, use the kubectl config get-contexts -o name command. This provides a list of clusters known to your current machine, helping you make informed deployment decisions.

Registering Target Clusters:

Imagine you’ve installed Argo CD in a ” test-deploy-cluster ” cluster and want to deploy applications onto a distinct cluster named “test-target-cluster.” You can register the “test-target-cluster” with Argo CD using the command:

argocd cluster add target-k8s

This operation equips Argo CD with the necessary credentials to interact with the new cluster. Argo CD becomes adept at deploying services, ensuring your applications find a home within the intended target cluster.

Enabling Cross-Cluster Deployment:

Adding a cluster’s login details enriches Argo CD’s capabilities, granting it the authority to deploy services across clusters seamlessly. This step optimizes deployment strategies while maintaining isolation and control, a critical aspect of managing complex applications at scale.

Step 5: Argo CD Kubernetes – Deploying an Application

Now that Argo CD is up and running and you’ve grasped the essentials of cross-cluster deployments, it’s time to put theory into action. This step involves deploying an example application using Argo CD’s capabilities.

Unveiling the Example Application:

Argo CD maintains a repository of example applications designed to showcase the fundamentals of GitOps. For this illustration, you’ll deploy the helm-guestbook example. This example leverages a Helm chart, a resilient Kubernetes management solution.

Creating the Application:

Use the argocd app create command to initiate the deployment of the helm-guestbook application. You’ll provide essential details like the Git repository’s path, destination server, and namespace:

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 default

Checking Application Status:

After “creating” the application within Argo CD, verify its status using the argocd app get command:

argocd app get helm-guestbook

This output provides crucial information about the application, including its health and synchronization status.

Synchronizing the Application:

To move forward and actually deploy the application, use the argocd app sync command:

argocd app sync helm-guestbook

Synchronization in Argo CD aligns with deployment, keeping your application configuration updated with its source repository. The helm-guestbook app will be synced to match its upstream configuration.

Accessing the Deployed Application:

With the application synced and running, you can view its status, components, logs, events, and health status. Additionally, you can interact with the application via the Argo CD web interface or the command line.

Congratulations! You’ve successfully deployed an application using Argo CD. 

Conclusion

If you want to increase your software distribution’s velocity, dependability, and safety, look no further than Argo CD. Argo CD is a fantastic choice to simplify your life by automating your deployments.

If your business is interested in using Argo CD, Triotech Systems can help. Help getting started with Argo CD and fixing any issues that crop up is provided by their team of seasoned engineers.

FAQs

CD stands for Continuous Delivery in ArgoCD. It’s a tool that automates deploying and managing applications in Kubernetes environments, ensuring consistent and efficient delivery.

Jenkins is a versatile automation server, while Argo CD is Kubernetes-focused. Argo CD uses GitOps to maintain Kubernetes app states, ensuring consistent configurations, while Jenkins is broader in scope.

Argo CD excels for Kubernetes deployments, enforcing GitOps. Jenkins is more diverse, serving various automation tasks. The choice depends on your needs – Kubernetes automation (Argo CD) or broader tasks (Jenkins).

Helm is a Kubernetes package manager. ArgoCD is a GitOps-based CD tool for Kubernetes. Helm focuses on packaging, ArgoCD on maintaining app states via GitOps.

ArgoCD simplifies Kubernetes deployments through GitOps, ensuring reliable and consistent app delivery. As Kubernetes gains traction, ArgoCD’s efficiency and automation have made it popular.

Recent Posts

Leave Comment