ArgoCD: Streamlining Kubernetes Deployments

Mehmet kanus
Hedgus
Published in
5 min readDec 28, 2023

In the dynamic landscape of containerized applications orchestrated by Kubernetes, managing deployments efficiently is crucial for seamless operations. This is where ArgoCD, a declarative, GitOps continuous delivery tool, steps in. ArgoCD simplifies the deployment and management of applications in Kubernetes clusters, offering a robust solution for organizations embracing containerized architectures.

What is ArgoCD?

ArgoCD, an open-source project, provides a declarative approach to managing Kubernetes manifests and configurations. It operates based on the GitOps philosophy, wherein the desired state of the system is specified in a Git repository. ArgoCD continuously monitors the repository, ensuring that the actual state of the system converges towards the desired state declared in Git.

Let’s start…

First, let’s create a Kubernetes cluster where we will install ArgoCD. After setting up the Kubernetes cluster using kubeadm, AWS EKS, Azure AKS, or GKE, we can install ArgoCD on the cluster following the steps I specify, once we deploy the sample application provided below.

Step-1: I will quickly set up Azure AKS using Azure CLI. You can also set it up in your preferred environment And, as an example, I’ve deployed two web applications along with MySQL to illustrate.

# creating resource group
az group create --name rg-mkanus --location eastus
# creating kubernetes cluster
az aks create --resource-group rg-mkanus --name mkanusm --location eastus --kubernetes-version 1.28.3 --tier standard --enable-cluster-autoscaler --node-count 2 --min-count 2 --max-count 3 --max-pods 110 --node-vm-size Standard_D2s_v3 --network-plugin azure --network-policy azure --load-balancer-sku standard --enable-addons monitoring --generate-ssh-keys

Step-2: Now that the Kubernetes cluster is ready with the applications deployed, we can proceed with the installation of ArgoCD.

# Create a new namespace named 'argocd' for ArgoCD installation
kubectl create namespace argocd

# Apply the ArgoCD installation manifests from the official repository
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

# Optionally, change the service type to NodePort using either 'patch' or 'edit' command based on your preference

# Using 'patch' command to set the service type to LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

# Alternatively, using 'edit' command to manually edit the service type to LoadBalancer
kubectl edit svc argocd-server -n argocd

# Retrieve the initial admin password for ArgoCD login
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
  • After installing ArgoCD, we can use the ‘kubectl get all -n argocd’ command to view all its components.

Note: I don’t prefer changing the argocd-server service type to NodePort or LoadBalancer. My preference is to keep the service type as ClusterIP. I can connect using Lens by making the redirection. I recommend using Lens. If you have installed the Kubernetes cluster using kubeadm, there shouldn’t be any issues.

Step-3: Now, we can connect to ArgoCD and synchronize it with our Git repository.

Step-4: If your repository is private, you can enter your repository and account information in Settings/Repositories/+ CONNECT REPO section. If it’s a public repository, you don’t need to do these steps.

  • After configuring the repository settings as shown in the image below, check the ‘Connect’ option.

Step-5: We can create a separate APP for each application from the Applications/NEW APP section, as seen in the image below. By connecting to each application’s path repository, we can ensure automatic synchronization.

  • Below, I’ve created an example APP only for the web application. You can create APPs for others as well if they exist.
  • Yes, I had three applications on my Kubernetes cluster. I synchronized all three of them with ArgoCD.

Step-6: As an example, I am individually deleting the deployment objects for both the web and result applications. You will see in the terminal and ArgoCD that the web application is being created in real-time.

Step-7: deleting with Foreground option.

Important Note: When deleting any APP from ArgoCD, if you use the ‘foreground’ option, the corresponding application is completely removed from the Kubernetes cluster. To only remove the application as an APP from ArgoCD, you should check the ‘non-cascading’ option before deletion.

Step-8: deleting with non-cascading option.

  • Do not forget deleting all resources.

--

--