GitOps Workflow On A Kind Kubernetes Cluster Using ArgoCD
GitOps Workflow on kind Kubernetes Using ArgoCD
GitOps is a modern approach to continuous deployment where Git is the single source of truth for infrastructure and application configurations. In this guide, we’ll set up GitOps using ArgoCD on a Kind Kubernetes cluster.
What is GitOps?¶
GitOps is a way of managing Kubernetes (and other systems) using Git repositories as the source of truth. With GitOps:
- You define your entire system configuration and applications in Git.
- Tools like ArgoCD automatically sync changes from Git to your Kubernetes cluster.
- Every change is version-controlled, reviewable, and reversible.
What is ArgoCD?¶
ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes. It:
- Watches a Git repository for manifest changes
- Automatically or manually syncs these changes into your Kubernetes cluster
- Provides a web UI and CLI for managing apps
Now, we will deploy an app using ArgoCD on Kubernetes.
Prerequisites¶
Before you begin, make sure you have the following installed:
Step 1: Create a Kind Cluster¶
We’ll use a custom configuration to expose the ArgoCD UI on port 8080.
cluster-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.32.2
extraPortMappings:
- containerPort: 30443
hostPort: 8080
protocol: TCP
listenAddress: "0.0.0.0"
- role: worker
image: kindest/node:v1.32.2
Create the Cluster¶
Run this command to create the Kubernetes cluster.
kind create cluster --name random-cluster --config cluster-config.yaml
You should see something like this:
Verify the cluster:
kubectl cluster-info --context kind-random-cluster
You will see
Step 2: Install ArgoCD¶
Let’s create a namespace called argocd
kubectl create namespace argocd
Apply ArgoCD Installation Manifests¶
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Expose ArgoCD Server¶
By default, the ArgoCD server is a ClusterIP service, not accessible outside the cluster. We'll change it to NodePort.
kubectl patch svc argocd-server -n argocd -p \
'{"spec": {"type": "NodePort", "ports": [
{"name": "http", "nodePort": 30080, "port": 80, "protocol": "TCP", "targetPort": 8080},
{"name": "https", "nodePort": 30443, "port": 443, "protocol": "TCP", "targetPort": 8080}
]}}'
Now the ArgoCD UI will be accessible at: https://localhost:8080
Log in to ArgoCD UI¶
Get the initial admin password:
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d && echo
Visit https://localhost:8080. Log in with:
Deploy an App Using GitOps¶
On the homepage, you will see the UI
argoCD UI
Now let’s deploy a sample Express.js app directly from a GitHub repo using GitOps!
We can use both ArgoCD and a manifest file to deploy apps. But in this post, we will use a manifest file.
ArgoCD Application Manifest¶
Save the following YAML file as express-app-application.yaml:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: express-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/OlyMahmudMugdho/kube-express
targetRevision: HEAD
path: k8s
destination:
server: https://kubernetes.default.svc
namespace: demo
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
Apply the Manifest¶
kubectl apply -f express-app-application.yaml
Verify Deployment¶
Go to the ArgoCD UI, you will see something like this:
Check the deployed resources:
kubectl get all -n demo
Access the Express App¶
Port forward the app to access it from the browser
kubectl port-forward svc/express-app-service 5000:80 -n demo
Visit: http://localhost:5000
Congratulations! 🎉 We’ve now built a full GitOps pipeline using:
- A local Kind cluster
- ArgoCD for Git-based deployment
- A GitHub repo containing Kubernetes manifests
More from M. Oly Mahmud¶
Recommended from Medium¶
[
See more recommendations
](https://medium.com/?source=post_page---read_next_recirc--aeeb85b15704---------------------------------------)






