This guide walks you through installing ArgoCD on your Kubernetes cluster and configuring it to automatically deploy the DevConnect application using a GitOps approach.
We have provided scripts to automate the installation of ArgoCD into your cluster.
.\install-argocd.ps1chmod +x install-argocd.sh
./install-argocd.shThese scripts will:
- Create a new
argocdnamespace. - Install ArgoCD components from the official manifests.
- Wait for the pods to be ready.
- Patch the
argocd-serverservice to useNodePortfor easier access.
-
Get the initial admin password: The installation script outputs the command to retrieve the password. Run it to get your password.
- Windows:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | % { [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_)) } - Linux/macOS:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
- Windows:
-
Access the Web UI: Since the service is patched to
NodePort, you can access it via your node's IP and the randomly assigned node port. You can find the port by running:kubectl get svc argocd-server -n argocd
Alternatively, you can securely port-forward to your local machine:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Now, open your browser and navigate to
https://localhost:8080(Ignore the self-signed certificate warning). -
Login:
- Username:
admin - Password: The password you retrieved in step 1.
- Username:
Once ArgoCD is running, we need to apply the Application manifest that tells ArgoCD to watch your Git repository.
- Push your code to GitHub.
- Open
devconnect-application.yamland update therepoURLfield with your actual GitHub repository URL (e.g.,https://github.com/myusername/DevConnect.git). - Apply the Application manifest to ArgoCD:
kubectl apply -f devconnect-application.yaml -n argocd
- Commit and Push: Whenever you make changes to your Kubernetes manifests (e.g., updating a Docker image tag in the
k8s/directory), you push those changes to your GitHub repository's main branch. - ArgoCD Sync: ArgoCD continuously monitors the
k8s/directory in your GitHub repository. - Automated Deployment: When ArgoCD detects a difference between the desired state in Git and the actual state in the Kubernetes cluster, it automatically applies the changes because
pruneandselfHealare enabled in the Application manifest.