Argo CD and GitOps: Setting Up Continuous Delivery on a Kubernetes Cluster

Argo CD and GitOps: Setting Up Continuous Delivery on a Kubernetes Cluster

Argo CD is an open-source GitOps continuous delivery tool for Kubernetes. In GitOps, all deployment manifests live in a Git repo as the source of truth. Argo CD continuously monitors the Git repo and the Kubernetes cluster, and automatically (or manually) syncs the live state to match the desired state in Git. It also provides a web-based UI to see “desired vs live” status of your applications. In this tutorial, we’ll install Argo CD on a local Minikube cluster, access the Argo CD web UI, and deploy a sample GitOps application (a simple NGINX example) from a public repository. We include step-by-step commands.

Prerequisites

  • A local Kubernetes cluster (we’ll use Minikube). Install Minikube and start it, for example:
  minikube start --memory=4096 --cpus=2

This creates a single-node cluster on your machine.

  • kubectl command-line tool installed and configured (it should point to the Minikube cluster).
  • (Optional) Argo CD CLI: You can install the argocd command for convenience (e.g. via brew install argocd on macOS, or download from GitHub releases on other platforms). The CLI lets you run argocd loginargocd app create, etc., from the terminal.

Installing Argo CD

First, create a dedicated namespace for Argo CD and install the official Argo CD manifests. Run:

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  • The first command makes a Kubernetes namespace called argocd.
  • The second command fetches and applies the Argo CD installation YAML from GitHub. This deploys the Argo CD components (API server, controller, UI, etc.) into the argocd namespace.

After a minute or two, verify that the Argo CD pods are running:

kubectl get pods -n argocd

You should see several pods (e.g. argocd-serverargocd-repo-serverargocd-dex-serverargocd-redis, etc.) with STATUS=Running. For example, you might see output like:

$ kubectl get pods -n argocd
NAME                                          READY   STATUS    RESTARTS   AGE
argocd-application-controller-0               1/1     Running   0          90s
argocd-applicationset-controller-75b8c...     1/1     Running   0          90s
argocd-dex-server-5bf8b66b55-vggd6            1/1     Running   0          90s
argocd-notifications-controller-dc5d7dd6-g8hrh 1/1     Running   0          90s
argocd-redis-6fd7cbd95d-cj28p                 1/1     Running   0          90s
argocd-repo-server-7c57dc5975-9fzrl           1/1     Running   0          90s
argocd-server-7c85877d9d-vj8h2                1/1     Running   0          90s

Each READY 1/1 Running line means that component is up. (These are sample values; your pod names and ages will differ.) This confirms that Argo CD is installed correctly.

Accessing the Argo CD UI

By default, the Argo CD Server service is a ClusterIP type, not exposed outside the cluster. We can use port-forwarding to access the web UI on our localhost. Open a new terminal and run:

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

This forwards your local port 8080 to the Argo CD API server’s port 443 in the cluster. You should see something like:

Forwarding from 127.0.0.1:8080 -> 8080

Now, Argo CD’s web UI is available at https://localhost:8080. (Ignore any “self-signed certificate” browser warning; it’s safe to proceed locally.)

Argo CD has a default admin user with a generated password. Retrieve that password with:

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

This command reads the argocd-initial-admin-secret, extracts the base64-encoded password, decodes it, and prints it. The username is admin. Copy this password (e.g. X5y8GvV0...) and go to your browser. Log in to https://localhost:8080 with:

  • Username: admin
  • Password: (the string from the command above)

After logging in, you’ll see the Argo CD dashboard (Applications list). At this point no applications have been created yet:

Figure: Argo CD web UI after login (no applications defined yet). The dashboard shows no apps, as we have not created any GitOps application. Users can click “New App” or use the CLI to add applications.

The screenshot above shows the empty Argo CD UI. From here, we can add our first application.

Creating a GitOps Application

Argo CD applications are Kubernetes workloads defined in a Git repository. You specify an Application object in Argo CD by giving it a Git repo URL, a path within that repo, and a target namespace/cluster. Argo CD then pulls the YAML/Helm/Kustomize manifests from Git and applies them to the cluster when you sync the app.

For example, we’ll deploy the “guestbook” sample app from the official Argo CD example repository (which includes a simple NGINX front-end). You can follow along using the CLI or UI; here we use the Argo CD CLI:

  1. (Optional) Set your kubectl context namespace: It’s convenient to run Argo CD CLI commands in the argocd namespace. You can do:
   kubectl config set-context --current --namespace=argocd

This ensures the argocd namespace is the default for subsequent kubectl calls.

  1. Create the application: Run the argocd app create command to tell Argo CD about the app. For example:
   argocd app create guestbook \
     --repo https://github.com/argoproj/argocd-example-apps.git \
     --path guestbook \
     --dest-server https://kubernetes.default.svc \
     --dest-namespace default
  • This creates an Argo CD Application named guestbook.
  • --repo points to the Git repo URL (here, the Argo CD examples repo).
  • --path guestbook means use the guestbook directory in that repo, which contains Kubernetes YAML for the example.
  • --dest-server and --dest-namespace indicate where to deploy in the cluster (the in-cluster API and the default namespace, in this case).
  1. View the application in the UI (or CLI): At this point Argo CD knows about the guestbook app but has not yet synced it. In the web UI you should see a new application entry (it may show resources Pending or Missing).

  1. Sync (deploy) the application: You can now apply the app’s manifests to the cluster. In the UI, click SYNC on the guestbook app. Or from the CLI run:
   argocd app sync guestbook

This tells Argo CD to pull the YAML from the Git repo and kubectl apply it on the cluster. After syncing, the app’s resources (Deployments, Services, etc.) should be created, and the UI will update their status to Healthy.

  1. Verify in the cluster: Back in your terminal, you can also check the deployed resources with kubectl, e.g.:
   kubectl get all -n default

You should see the guestbook-ui service and pods, etc. For example:

   NAME                          READY   STATUS    RESTARTS   AGE
   pod/guestbook-ui-xxxxx        1/1     Running   0          30s
   ...other guestbook pods...

   NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
   service/guestbook-ui ClusterIP   10.96.0.50     <none>        80/TCP     30s
   ...other services...
  1. (Optional) Access the app: To see the guestbook app’s NGINX page, you can forward its service port locally. For example:
   kubectl port-forward svc/guestbook-ui -n default 8081:80

Now open http://localhost:8081 in your browser to view the app’s UI. (This step is optional and depends on the sample app chosen.)

At this point you have a working GitOps deployment: the application’s YAML came from Git, Argo CD deployed it, and the UI shows its status. Any future change you commit to the Git repo (e.g. scaling the Deployment, changing an image tag) can be synced by Argo CD to update the cluster.

Summary and Next Steps

In this tutorial we installed Argo CD on a local Minikube cluster, exposed its web UI, and deployed a sample application from a Git repo. The step-by-step commands were:

  • Create the Argo CD namespace and apply the install manifest.
  • Verify the Argo CD pods are running (kubectl get pods -n argocd).
  • Port-forward the Argo CD server to localhost:8080 and log in with the default admin password.
  • Use argocd app create and argocd app sync (or the UI) to define and deploy a GitOps application.

For next steps, you might explore Argo CD features such as automated syncs (auto-deploy on Git changes), health checks, or using different repositories (Helm charts, Kustomize, etc.). You can also connect Argo CD to additional clusters (multi-cluster GitOps) or integrate it into a CI/CD pipeline. Argo CD supports RBAC, SSO, and other advanced options if you need them. See the Argo CD documentation for more in-depth guides. With Argo CD set up, you now have a powerful GitOps workflow: every change to your Kubernetes manifests in Git can be deployed reliably and automatically to your cluster.

Posts Carousel

Leave a Comment

Your email address will not be published. Required fields are marked with *

Latest Posts

Most Commented

Featured Videos