Applying GitOps Principles Using Argo CD
Understand the complete Gist procedure for applying GitOps principles using Argo CD.
############################################# Applying GitOps Principles Using Argo CD #################################################################################### Installing And Configuring Argo CD ######################################## Docker Desktop (docker-3gb-2cpu.sh): https://gist.github.com/0fff4fe977b194f4e9208cde54c1aa3c# Minikube (minikube.sh): https://gist.github.com/2a6e5ad588509f43baa94cbdf40d0d16# GKE (gke-simple-ingress.sh): https://gist.github.com/925653c9fbf8cce23c35eedcd57de86e# EKS (eks-simple-ingress.sh): https://gist.github.com/2fc8fa1b7c6ca6b3fefafe78078b6006# AKS (aks-simple-ingress.sh): https://gist.github.com/e24b00a29c66d5478b4054065d9ea156cd devops-catalog-codegit pull# Only if macOSbrew tap argoproj/tap# Only if macOSbrew install argoproj/tap/argocd# Only if Linux or WSLVERSION=$(curl --silent \"https://api.github.com/repos/argoproj/argo-cd/releases/latest" \| grep '"tag_name"' \| sed -E 's/.*"([^"]+)".*/\1/')# Only if Linux or WSLsudo curl -sSL -o /usr/local/bin/argocd \https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64# Only if Linux or WSLsudo chmod +x /usr/local/bin/argocdkubectl create namespace argocdhelm repo add argo \https://argoproj.github.io/argo-helmcat argo/argocd-values.yamlhelm upgrade --install \argocd argo/argo-cd \--namespace argocd \--set server.ingress.hosts="{argocd.$INGRESS_HOST.nip.io}" \--values argo/argocd-values.yaml \--waitexport PASS=$(kubectl --namespace argocd \get pods \--selector app.kubernetes.io/name=argocd-server \--output name \| cut -d'/' -f 2)argocd login \--insecure \--username admin \--password $PASS \--grpc-web \argocd.$INGRESS_HOST.nip.ioecho $PASSargocd account update-passwordopen http://argocd.$INGRESS_HOST.nip.iokubectl --namespace argocd get podscd ../########################################## Deploying An Application With Argo CD ##########################################git clone \https://github.com/vfarcic/devops-toolkit.gitcd devops-toolkitls -1 k8skubectl create namespace devops-toolkitargocd app create devops-toolkit \--repo https://github.com/vfarcic/devops-toolkit.git \--path k8s \--dest-server https://kubernetes.default.svc \--dest-namespace devops-toolkitopen http://argocd.$INGRESS_HOST.nip.iokubectl --namespace devops-toolkit \get allargocd app delete devops-toolkitopen http://argocd.$INGRESS_HOST.nip.iokubectl --namespace devops-toolkit \get allkubectl delete namespace devops-toolkitls -1 helmcd ..################################ Defining Whole Environments ################################open https://github.com/vfarcic/argocd-production# Replace `[...]` with the GitHub organizationexport GH_ORG=[...]git clone \https://github.com/$GH_ORG/argocd-production.gitcd argocd-productioncat project.yamlkubectl apply \--filename project.yamlkubectl --namespace argocd \get appprojectsopen http://argocd.$INGRESS_HOST.nip.io/settings/projectskubectl create namespace productionls -1 helmls -1 helm/templatescat helm/templates/devops-toolkit.yamlcat helm/templates/devops-paradox.yamlcat apps.yamlcat apps.yaml \| sed -e "s@vfarcic@$GH_ORG@g" \| tee apps.yamlgit add .git commit -m "Changed the org"git pushkubectl --namespace argocd apply \--filename apps.yamlopen http://argocd.$INGRESS_HOST.nip.iokubectl --namespace production get allkubectl --namespace production get ingresses#################################################### Updating Applications Through GitOps Principles ####################################################cat helm/templates/devops-toolkit.yaml \| sed -e "s@latest@2.9.17@g" \| sed -e "s@devopstoolkitseries.com@devops-toolkit.$INGRESS_HOST.nip.io@g" \| tee helm/templates/devops-toolkit.yamlgit add .git commit -m "New release"git pushkubectl --namespace production get \deployment devops-toolkit-devops-toolkit \--output jsonpath="{.spec.template.spec.containers[0].image}"kubectl --namespace production get \deployment devops-toolkit-devops-toolkit \--output jsonpath="{.spec.template.spec.containers[0].image}"kubectl --namespace production get ingressesopen http://devops-toolkit.$INGRESS_HOST.nip.iorm helm/templates/devops-paradox.yamlgit add .git commit -m "Removed DOP"git pushopen http://argocd.$INGRESS_HOST.nip.iokubectl --namespace production get pods############################# Destroying The Resources #############################kubectl delete namespace argocdkubectl delete namespace productioncd ..
Get hands-on with 1200+ tech skills courses.