Deploy a application to Kubernetes through ArgoCD and GitOps

Prerequisites

  • Make sure you have a cluster ready on your terminal
  • ArgoCD is installed on the cluster

You can install ArgoCD with the following commands

  • This is optional, you can create a namespace "argocd" or go ahead with the "defautl" namespace
    kubectl create namespace argocd

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

  • Install the CLI with brew, for using the argocd commands
    brew install argocd

  • Enter the following command for getting the password
    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

  • Forward the port to 8080, for accessing it on browser
    kubectl port-forward svc/argocd-server -n argocd 8080:443

  • Now switch to another terminal, and make sure it keeps on running the forward command in the previous one

Deployment

  • Use the create command for creating the deployment
    argocd app create zomato-clone --repo https://github.com/Kanika637/Deployment-through-ArgoCD-and-GitOps.git --path dev --dest-server https://kubernetes.default.svc --dest-namespace default

  • zomato-clone-> Name of your application

  • --repo-> Repository URL of the application

  • --path-> The path where all the YAML files are located in the repository

  • --dest-server-> Destination cluster URL

  • --dest-namespace-> The namespace

image

  • Now use the sync command for deploying
    argocd app sync zomato-clone

6

  • You can check the status by
    argocd app get zomato-clone

image

8

  • Let's check the services
    kubectl get svc

image

  • Port forwarding for accessing the application on port 9090
    kubectl port-forward svc/zomato-clone 9090:80

1

Application Deployed through CLI 🎉, you can also do this through the UI 🚀