
Argo CD is a Kubernetes-native declarative GitOps tool for deploying large-scale applications on Kubernetes. It is lightweight, handy, and user-focused compared to other continuous delivery tools. In addition, it can pull application code directly from a Git repository and deploy it to a Kubernetes cluster. It supports different configuration management options, such as YAML, Kustomize, Jsonnet, Helm, and so on. Argo CD has a built-in web UI where you can monitor synchronizations and the application's state.
In this article, you will install Argo CD on your Kubernetes cluster, access its web UI, and deploy applications using Argo CD UI and Argo CD CLI.
Before you start, you need to:
kubectl CLI on your local machine.argo.example.com.Create a namespace for Argo CD.
In your home directory, create a new directory for Argo CD.
Navigate to the argocd directory.
Clone the Argo CD Helm repository.
Navigate to the argo-cd directory of this repository.
Update Helm dependencies.
Using Helm, install Argo CD in the argocd namespace.
When successful, you get an output with metadata about your installation.
Verify that Argo CD is deployed to the argocd namespace.
The output should display a list of pods with names starting with argocd-, representing the various ArgoCD components.
Use the following command to get information about all running services and ports.
Output:
The argocd-server service serves the Argo CD UI.
At this point, Argo CD is installed and running. However, the Argo CD UI is not accessible outside the Kubernetes cluster. You can use port forwarding to expose the argocd-server service port to a port on your localhost. This way, you can access Argo CD without exposing the service to the external network.
Extract the default admin account password stored in a secret named argocd-initial-admin-secret.
The encrypted password should display in your output as below.
In the above output, TU1DaWRNQVJXNWJ3S1FBNA== is the admin account password. Copy the encrypted password to your clipboard for decoding.
Decode the password.
Copy the output.
Using kubectl, forward the port 443 of the argocd-server service to port 8080 of your localhost.
Your output should look like the one below.
This command will occupy your current terminal session.
Open the URL http://127.0.0.1:8080 on a web browser on your local machine to access the Argo CD UI.
Enter admin as the username, paste the password you decoded earlier, and click the Sign In button.
You are redirected to the Argo CD dashboard if the credentials are correct.
You can only access the Argo CD dashboard till the port forward is active. Press Ctrl + C on your terminal to end the port forward command.
Argo CD also offers a CLI tool that lets you deploy the application and enables other tasks, including syncing, refreshing, and pausing the Argo CD application as described in this section. Keeping the port forward command from the last section active in one terminal, open a new terminal and follow the below steps:
Using the wget utility, download the latest Argo CD CLI tool.
This command installs the version 2.7.4. You can get the latest version from the Assets section of the official GitHub repository page.
Move the downloaded binary to the system-wide directory /usr/local/bin/ that stores executable binaries.
Grant execute permissions on the Argo CD binary.
Use the argocd login command to log in to the Argo CD server.
Accept the server certificate, then enter the username admin and the decoded password, as shown below.
When logged in, your output should look like the one below.
To tighten server security, change the default password of your Argo CD installation.
It prompts you to enter your existing password, a new strong password, and confirm the new password.
You can create and deploy Argo CD applications in multiple ways — using YAML files, the Argo CD UI, or the Argo CD CLI. In this section, you'll deploy two Argo CD applications to your cluster, one using a YAML file and the other via the Argo CD UI.
Create a YAML file for your application.
Add the following configuration.
Save and close the file
Apply the YAML configuration.
Verify the deployment status of the application.
Output:
You can also verify the deployment using the Argo CD CLI tool.
Output:
To get detailed information on your application, run the following command.
Output:
In your web browser session, refresh the dashboard to view the deployed Argo CD application as below.
Load the Argo CD UI dashboard. Click the NEW APP to view the Application configuration screen.
Using the Argo CD CLI, run the following command to check the status of your deployed application.
Output:
As displayed in the above output, the application is deployed but the status is OutofSync. To sync it, run the following command.
The above command fetches the necessary manifests from the application repository and uses kubectl to configure it.
On the Argo CD web dashboard, verify the health status of your application.
Click the application to view more information about it.
This section covers the steps to expose your Argo CD server using Nginx Ingress controller, terminated using TLS encryption.
Install Nginx Ingress controller on your cluster.
This command installs the Nginx Ingress controller in a new Namespace ingress-nginx and names its resources starting with my-ingress-nginx-.
Check the Ingress Services to get the Load balancer IP address.
Output:
Take note of the EXTERNAL-IP value of the my-ingress-nginx-controller service, and create a domain A DNS record for your domain, such as argo.example.com.
The service my-ingress-nginx-controller may take some time to get its EXTERNAL-IP value. Until it gets it, its value is displayed as <pending>. Give it some time to get its value.
Install cert-manager.
This command installs the v1.17.2 version of cert-manager on your cluster in cert-manager namespace. You can get the latest version of cert-manager from its official releases page.
Create a manifest file to provision an Issuer resource.
Add the following content to the file.
Replace admin@example.com with your email address. Otherwise the Issuer will not work.
Save and exit the file.
Create a manifest file to provision the Ingress resource for the argocd-server service.
Add the following content to the file.
Save and exit the file.
Check the tls certificate.
Output:
After sometime, the status of the certificate changes to True.
Verify the configuration by visiting your domain name https://argo.example.com in a web browser.
You have installed Argo CD on a Kubernetes cluster and explored how to deploy applications using the Argo CD UI, Argo CD CLI, and using YAML configuration files. For more information about Argo CD, please visit the official documentation.
0 Comments
Be the first to comment and share your perspective with the community.