Skip to content

Instantly share code, notes, and snippets.

@Ompragash
Created December 6, 2024 09:42
Show Gist options
  • Select an option

  • Save Ompragash/85a05e6bb8f0e625330c8c46819e5ada to your computer and use it in GitHub Desktop.

Select an option

Save Ompragash/85a05e6bb8f0e625330c8c46819e5ada to your computer and use it in GitHub Desktop.
Argo CD - Getting Started Guide

Argo CD Quick Start Guide

1. Install Kubernetes (k3s - Lightweight, Production-Grade)

curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.29.6+k3s2 sh -s - --write-kubeconfig-mode 644

2. Install Argo CD CLI

VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
curl -sSL -o argocd-linux-amd64 "https://github.com/argoproj/argo-cd/releases/download/${VERSION}/argocd-linux-amd64"
chmod +x argocd-linux-amd64
sudo mv argocd-linux-amd64 /usr/local/bin/argocd
argocd version

3. Deploy Argo CD

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Change the Argo CD server service type to NodePort:

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'

Retrieve the NodePort:

kubectl get svc argocd-server -n argocd

Example access URL: http://localhost: (e.g. http://localhost:30084)

4. Get the Initial Admin Password

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

5. Log in via CLI

argocd login localhost:30084 --username admin --password <PASSWORD> --insecure

6. Install Argo CD Image Updater

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/master/manifests/install.yaml
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-image-updater

Check Image Updater logs:

kubectl logs -n argocd deploy/argocd-image-updater

7. Set Up the Sample App Repository

  1. Fork this repo: https://github.com/Ompragash/app-repo
  2. In your forked repo, add the following secrets under Settings > Secrets and Variables > Actions:
  • DOCKERHUB_USERNAME
  • DOCKERHUB_PASSWORD

These credentials allow the GitHub Action to build and push a new image to Docker Hub whenever you push to main.

8. Set Up the Sample Manifest Repository

  1. Fork this repo: https://github.com/Ompragash/manifest-repo
  2. In ./k8s/deployment.yaml, update the Docker image at line 19 to the image built from your app-repo step.
  3. In ./application.yaml, update the Docker image at line 9 and the repo URL at line 22 with your forked repository details.

After updating the above, pushing the changes, clone the fork in your local and apply the application.yaml:

kubectl apply -f application.yaml -n argocd

This deploys the sample app for Argo CD to manage.

9. Check the App Status

argocd app list
argocd app get my-webapp

Access the app at http://localhost:30080 (or the NodePort you have set in your service.yaml).

10. Verify Argo CD Image Updater in Action

Add your forked manifest repository to Argo CD with credentials:

argocd repo add https://github.com/FORK_USERNAME/manifest-repo.git \
  --username $GITHUB_USERNAME \
  --password $GITHUB_PAT \
  --insecure-ignore-host-key

Now, modify server.js in your app-repo fork at line 7 and push the changes. This triggers a GitHub Action that builds and pushes a new image to Docker Hub.

Once the new image is available, Argo CD Image Updater detects it, updates the manifest in Git (basically, it'll update the live application spec), and Argo CD applies the changes automatically.

Refresh http://localhost:30080 to see your updated application, confirming the entire pipeline works end-to-end.

Happy Automating!🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment