Logo AppDev24 Login / Sign Up
Sign Up
Have Login?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Login
New Account?
Recovery
Go to Login
By continuing you indicate that you agree to Terms of Service and Privacy Policy of the site.
Kubernetes

Install Argo CD in Kubernetes

Updated on Aug 15, 2024

Argo CD is a powerful continuous delivery tool for managing Kubernetes resources through a GitOps approach. With Argo CD, your Git repository is the single source of truth for your application’s desired state, ensuring consistency and reliability across your deployments.

Why Argo CD?

Argo CD offers several advantages:

  • GitOps Workflow: Use Git repositories as the source of truth for deployment configurations
  • Declarative Setup: Manage applications declaratively with versioning and auditing
  • Real-time Monitoring: Continuous monitoring of applications to ensure the live state matches the desired state
  • Automated Rollbacks: Automatic rollback to a previous healthy state if a deployment fails
  • Multi-cluster Support: Manage deployments across multiple clusters from a single Argo CD instance

Argo CD Architectural Overview

The architecture of Argo CD allows efficient management and deployment of applications.

Architectural Overview
Architectural Overview

In this guide, we'll walk through the process of installing Argo CD on a Kubernetes cluster running on Docker Desktop on MacOS.

Create Self-Signed Certificate

Pre-requisite: openssl must be installed in MacOS

openssl req -x509 -nodes -days 365 \
    -subj "/C=DE/ST=Berlin/L=Berlin/O=appdev24/OU=dev/CN=argo-cd.local" \
    -newkey rsa:4096 -keyout selfsigned.key \
    -out selfsigned.crt

-subj switch option:

  • Country Name (2 letter code): DE
  • State or Province Name (full name): Berlin
  • Locality Name (city): Berlin
  • Organization Name (company): appdev24
  • Organizational Unit Name (department): dev
  • Common Name (server FQDN): argo-cd.local

Update hosts file

Add an entry for Argo CD API Server

sudo vi /etc/hosts

# Append the server entry
127.0.0.1	argo-cd.local

Create Kubernetes Namespace

Create a dedicated namespace for Argo CD in your Kubernetes cluster.

kubectl create namespace argo-cd

Create Kubernetes Secret

Store the self-signed TLS certificate as a Kubernetes secret.

kubectl create secret tls argocd-server-tls --namespace argo-cd --cert=selfsigned.crt --key=selfsigned.key

Install Argo CD

Install Argo CD using the Helm chart and expose the Argo CD API server using the Nginx Ingress Controller with SSL termination.

helm upgrade --install argo-cd argo-cd \
    --repo https://argoproj.github.io/argo-helm \
    --namespace argo-cd \
    --set global.domain=argo-cd.local \
    --set configs.params."server\.insecure"=true \
    --set server.ingress.enabled=true \
    --set server.ingress.ingressClassName=nginx \
    --set server.ingress.annotations."nginx\.ingress\.kubernetes\.io/force-ssl-redirect"="true" \
    --set server.ingress.annotations."nginx\.ingress\.kubernetes\.io/backend-protocol"="HTTP" \
    --set server.ingress.tls=true

Generate Password

Retrieve the initial password for the Argo CD admin user.

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

# I-yHGc0tlC3lOwrG

Login to API Server

Now you can login to the Agro CD API Server at https://argo-cd.local. Use the retrieved password to log in as the admin user.

Optionally you can download the self signed certificate from
Chrome > Developer Tools > Security Tab > View Certificate
and import into MacOS System Keychain to Always Trust the self signed certificate and avoid the certificate warning.

Optional: Register Cluster to Deploy Apps

If you want to deploy applications to an external cluster, you need to register that cluster's credentials with Argo CD. For internal deployments (to the same cluster where Argo CD is running), use https://kubernetes.default.svc as the application's Kubernetes API server address.

argocd cluster add <CONTEXTNAME>

Create an Application

Argo CD allows you to create applications directly from your Git repositories. Configure your application to sync and deploy the resources defined in your Git repository to Kubernetes cluster.

Sync the Application

Once your application is created, you can sync it to deploy the defined resources to your Kubernetes cluster.

Click on Synchronize.

Verify Deployment

The application has been deployed successfully in the Kubernetes cluster.

Click on the application to view the details.

Finally verify the application deployment at https://python-api.local/api/products

By following these steps, you'll have a fully functional Argo CD setup on your local Kubernetes cluster running on Docker Desktop. This setup allows you to manage your Kubernetes resources declaratively and leverage the benefits of a GitOps workflow.

PrimeChess

PrimeChess.org

PrimeChess.org makes elite chess training accessible and affordable for everyone. For the past 6 years, we have offered free chess camps for kids in Singapore and India, and during that time, we also observed many average-rated coaches charging far too much for their services.

To change that, we assembled a team of top-rated coaches including International Masters (IM) or coaches with multiple IM or GM norms, to provide online classes starting from $50 per month (8 classes each month + 4 tournaments)

This affordability is only possible if we get more students. This is why it will be very helpful if you could please pass-on this message to others.

Exclucively For Indian Residents: 
Basic - ₹1500
Intermediate- ₹2000
Advanced - ₹2500

Top 10 Articles