ArgoCD setup:
ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes that automates the deployment of applications. It synchronizes the desired application state defined in Git repositories with the current state in Kubernetes clusters. ArgoCD provides real-time monitoring, rollback capabilities, and supports multiple deployment strategies. We will be exploring it for the SunbirdED easyinstaller setup
Installation and setup:
Instructions to install ArgoCD in easyinstaller-6.0.0
Export KUBECONFIG file of easyinstaller-6.0.0 cluster Ex:
KUBECONFIG=/home/ubuntu/.kube/easyinstall-6.0.0.yaml
Create namespace and install
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Accessing the ArgoCD API server
By default the API Server is not exposed publicly . To expose via Load balancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
# Get loadbalancer IP
kubectl get svc argocd-server -n argocd --output jsonpath='{.status.loadBalancer.ingress[0].ip}'
You can access the UI at https://LoadBalancerIP/
The admin
user initial password is stored as a secret . Once logged in change the password https://LoadBalancerIP/user-info?changePassword=true and delete the secret
# Get the secret
kubectl get secrets argocd-initial-admin-secret -n argocd -o jsonpath='{.data}' | base64 -d
# After resetting the password, delete the secret
kubectl delete secret argocd-initial-admin-secret -n argocd
Adding an App / helm chart repo:
Login to ArgoCD → Applications - NEW APP
Fill in the details of the app details. The sync policy is set as Manual as default
Add the repo,branch and path details of the helm chart . Select the cluster url from dropdown and add the namespace where the charts needs to be deployed. ( please refer screenshot for example values)
After filling in the details click on Create
Using multiple sources (values file) for a helm chart:
Add the private repo to ArgoCD where the secrets values are stored:
Login to ArgoCD → Settings → Repositories and click on CONNECTREPO and fill in the repo details and click CONNECT ( please refer screenshot for example)
The next step is to include the private repo in the app. Currently the UI doesn’t support adding mutiple repo soures. So, we will be editing the manifest file directly.
Go to Applications → select the app that needs to updated → click on details
From the details page Select manifest and edit the yaml file to include mutiple sources. and save
Ex:
project: default
destination:
server: 'https://kubernetes.default.svc'
namespace: sunbird
sources:
- repoURL: 'https://github.com/project-sunbird/sunbird-ed-installer'
path: helmcharts/edbb/charts
targetRevision: release-6.0.0
helm:
valueFiles:
- $values/es6-values.yaml
- repoURL: 'https://github.com/project-sunbird/es6'
targetRevision: main
ref: values
You can now test the application by making changes to the values.yaml in the private repo . The application should show Out-of-Sync in the Sync Status
Click on Sync to apply the changes.