22 August 2023

Deploy ArgoCD in k8s

ArgoCD is a declarative, GitOps-driven continuous delivery tool designed specifically for Kubernetes.
Unlike traditional tools, ArgoCD uses Git repositories to hold the precise definition of your application's desired state, making it your single source of trust.

๐—ช๐—ต๐—ฎ๐˜ ๐— ๐—ฎ๐—ธ๐—ฒ๐˜€ ๐—”๐—ฟ๐—ด๐—ผ๐—–๐—— ๐—ฆ๐—ฝ๐—ฒ๐—ฐ๐—ถ๐—ฎ๐—น?

๐—”๐˜‚๐˜๐—ผ๐—บ๐—ฎ๐˜๐—ฒ๐—ฑ ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜๐˜€:ArgoCD can automatically deploy your applications to your cluster, be it through a Git commit, a CI/CD pipeline trigger, or even a manual request. Think of the time and effort you'll save!

๐—œ๐—ป๐˜€๐˜๐—ฎ๐—ป๐˜ ๐—ข๐—ฏ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ฎ๐—ฏ๐—ถ๐—น๐—ถ๐˜๐˜†: With its GUI and CLI, ArgoCD lets developers instantly check whether the application's live state aligns with the desired state. Itโ€™s like having a crystal ball for your deployments.

Powerful Operations: It's not just about top-level resources. ArgoCD's UI provides a detailed view of the entire application resource hierarchy, including the underlying ReplicaSets and Pods. Want to see Pod logs and Kubernetes events? Itโ€™s all there in a multi-cluster dashboard.

๐—ช๐—ต๐˜† ๐—”๐—ฟ๐—ด๐—ผ๐—–๐——?

ArgoCD is more than just a tool, it's a strategy in the chaotic world of DevOps. It helps:

โœ… Bring order to the chaos
โœ… Reach your DevOps milestones
โœ… Save precious time and energy for your team

๐—•๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฉ๐—ถ๐—ฐ๐˜๐—ผ๐—ฟ ๐—ถ๐—ป ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ ๐—•๐—ฎ๐˜๐˜๐—น๐—ฒ

If your DevOps environment feels overwhelming, ArgoCD might be the tool you've been searching for. It's designed to tame the chaos, streamline operations, and position you as a victor in the ever-challenging DevOps landscape.

Setup ArgoCD in your kubernetes cluster

if you have a cluster not up and running already follow the article here to set up one - 

https://cloudnetes.blogspot.com/2018/02/launching-kubernetes-cluster-different.html
Launch k8s-cluster


 Create argocd namespace in your cluster
 $ kubectl create namespace argocd


 
 Run the Argo CD install script provided by the project maintainers
 $ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml



 Verify the argocd pods and resources
 $ kubectl get all -n argocd
 $ watch kubectl get pods -n argocd


there are different articles on the internet that will misguide you in doing port forwarding to access the argocd dashboard which I am not sure how that will work, instead should try following the basic method -

 
 expose your argocd-server deployment as NP or LB type to access Argo CD
 $ kubectl expose deploy/argocd-server --type=NodePort --name=arg-svc
 $ kubectl expose deploy/argocd-server --type=LoadBalancer --name=argcd-svc

 Alternatively if you are deploying it to a cloud k8s service, use -
 $ kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

 Fetch the LoadBalancer DNS
 $ export ARGOCD_SERVER=`kubectl get svc argocd-server -n argocd -o json \
   | jq --raw-output '.status.loadBalancer.ingress[0].hostname'`
 $ echo $ARGOCD_SERVER


access the argocd deployment by hitting the public IP and port of your exposed service that you created in the command above



 Fetch the passwd of argocd from secrets
 $ kubectl get secret argocd-initial-admin-secret -o yaml
 $ echo "Q20yMGV0DeMo05WZ0otZg==" | base64 -d
 Cm20eDeMoSNVgJ-f
 
 OR

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


Forgot your argocd password after you have changed it, patch the secret.

To reset password you might remove โ€˜admin.passwordโ€™ and โ€˜admin.passwordMtimeโ€™ keys from argocd-secret and restart api server pod. Password will be reset to pod name.


 $ kubectl patch secret argocd-secret  -p '{"data": {"admin.password": null, "admin.passwordMtime": null}}' -n argocd
 $ kubectl delete pod/argocd-server-756bbc65c5-zttw4 -n argocd
 
 fetch new pass again -
 $ kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo


Once you are in do the following -
โœ… connect repositories
โœ… create application
โœ… Sync up your deployment

ex- thats how your apps will be shown once added to argocd



No comments:

Post a Comment