Using Argo Rollouts to Deploy Applications
Review the Gist for using Argo Rollouts to deploy the application.
Press + to interact
############################################### Using Argo rollouts to deploy applications ############################################################################################ Installing and configuring Argo rollouts ############################################## Docker desktop (docker-istio.sh): https://gist.github.com/a3025923ad025215fe01594f937d4298)# Minikube (minikube-istio.sh): https://gist.github.com/1ab5f877852193e8ebd33a97ae170612)# GKE (gke-istio.sh): https://gist.github.com/d5c93afc83535f0b5fec93bd03e447f4)# EKS (eks-istio.sh): https://gist.github.com/2ebbabc3ff515ed27b2e46c0201fb1f8)# AKS (aks-istio.sh): https://gist.github.com/2ec945256e3901fee1a62bb04d8b53b0)# If macOSbrew install \argoproj/tap/kubectl-argo-rollouts# If Linux or WSLcurl -LO https://github.com/argoproj/argo-rollouts/releases/download/v0.9.1/kubectl-argo-rollouts-linux-amd64# If Linux or WSLchmod +x kubectl-argo-rollouts-linux-amd64# If Linux or WSLsudo mv ./kubectl-argo-rollouts-linux-amd64 \/usr/local/bin/kubectl-argo-rolloutskubectl argo rollouts --helpkubectl create namespace argo-rolloutskubectl --namespace argo-rollouts apply \--filename https://raw.githubusercontent.com/argoproj/argo-rollouts/stable/manifests/install.yamlgit clone https://github.com/vfarcic/devops-toolkit.gitcd devops-toolkitgit pullcat helm/templates/rollout.yamlcat helm/templates/hpa.yamlcat helm/templates/istio.yamlcat helm/values.yaml################################ Deploying the first release ################################cat rollout/values-pause-x2.yamlhelm upgrade --install \devops-toolkit helm \--namespace devops-toolkit \--create-namespace \--values rollout/values-pause-x2.yaml \--set ingress.host=devops-toolkit.$ISTIO_HOST.nip.io \--set image.tag=2.6.2 \--waithelm upgrade --install \devops-toolkit helm \--namespace devops-toolkit \--create-namespace \--values rollout/values-pause-x2.yaml \--set ingress.host=devops-toolkit.$ISTIO_HOST.nip.io \--set image.tag=2.6.2 \--waitkubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# If NOT Minikubeopen http://devops-toolkit.$ISTIO_HOST.nip.io##################################################### Deploying new releases using the Canary strategy #####################################################helm upgrade devops-toolkit helm \--namespace devops-toolkit \--reuse-values \--set image.tag=2.9.9kubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# If NOT Minikubefor i in {1..100}; docurl -s http://devops-toolkit.$ISTIO_HOST.nip.io \| grep -i "catalog, patterns, and blueprints"done | wc -l# If Minikubefor i in {1..100}; docurl -s -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST" \| grep -i "catalog, patterns, and blueprints"done | wc -lkubectl --namespace devops-toolkit \get virtualservice \devops-toolkit-devops-toolkit \--output yamlkubectl argo rollouts \--namespace devops-toolkit \promote devops-toolkit-devops-toolkitkubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# If not Minikubefor i in {1..100}; docurl -s http://devops-toolkit.$ISTIO_HOST.nip.io \| grep -i "catalog, patterns, and blueprints"done | wc -l# If Minikubefor i in {1..100}; docurl -s -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST" \| grep -i "catalog, patterns, and blueprints"done | wc -lkubectl argo rollouts \--namespace devops-toolkit \promote devops-toolkit-devops-toolkitkubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# If not Minikubefor i in {1..100}; docurl -s http://devops-toolkit.$ISTIO_HOST.nip.io \| grep -i "catalog, patterns, and blueprints"done | wc -l# If Minikubefor i in {1..100}; docurl -s -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST" \| grep -i "catalog, patterns, and blueprints"done | wc -l############################## Rolling back new releases ##############################helm upgrade devops-toolkit helm \--namespace devops-toolkit \--reuse-values \--set image.tag=2.9.17kubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# Do not run this commandkubectl argo rollouts \--namespace devops-toolkit \abort devops-toolkit-devops-toolkithelm upgrade devops-toolkit helm \--namespace devops-toolkit \--reuse-values \--set image.tag=2.9.9kubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch############################################################# Exploring Prometheus metrics and writing rollout queries #############################################################echo $ISTIO_HOST# Open a second terminal session.export ISTIO_HOST=[...]# If not Minikubewhile true; docurl -I http://devops-toolkit.$ISTIO_HOST.nip.iosleep 1done# If Minikubewhile true; docurl -I -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST"sleep 1done# If WSL and `sleep` fails with `sleep: cannot read realtime clock: Invalid argument` (it's a bug in WSL 1, upgrades Ubuntu to 20.04)sudo apt-mark hold libc6# If WSL and `sleep` fails with `sleep: cannot read realtime clock: Invalid argument` (it's a bug in WSL 1, upgrades Ubuntu to 20.04)sudo apt -y --fix-broken install# If WSL and `sleep` fails with `sleep: cannot read realtime clock: Invalid argument` (it's a bug in WSL 1, upgrades Ubuntu to 20.04)sudo apt update# If WSL and `sleep` fails with `sleep: cannot read realtime clock: Invalid argument` (it's a bug in WSL 1, upgrades Ubuntu to 20.04)sudo apt -y full-upgrade# Go back to the first terminal sessionhelm repo add prometheus \https://prometheus-community.github.io/helm-chartshelm upgrade --install \prometheus prometheus/prometheus \--namespace monitoring \--create-namespace \--waitkubectl --namespace monitoring \port-forward deployment/prometheus-server \9090 &open http://localhost:9090# Prometheus query (uncomment first):# istio_requests_total# Prometheus query (uncomment first):# sum(irate(# istio_requests_total{# reporter="source",# destination_service=~"devops-toolkit-devops-toolkit.devops-toolkit.svc.cluster.local"# }[2m]# ))# Prometheus query (uncomment first):# sum(irate(# istio_requests_total{# reporter="source",# destination_service=~"devops-toolkit-devops-toolkit.devops-toolkit.svc.cluster.local",# response_code=~"2.*"# }[2m]# )) / sum(irate(# istio_requests_total{# reporter="source",# destination_service=~"devops-toolkit-devops-toolkit.devops-toolkit.svc.cluster.local"# }[2m]# ))pkill kubectl################################# Exploring Automated Analysis #################################cat rollout/values-analysis.yamlcat helm/values.yamlcat helm/templates/rollout.yamlkubectl delete namespace devops-toolkit################################################## Deploying releases with fully automated steps ################################################### If NOT Minikubehelm upgrade --install \devops-toolkit helm \--namespace devops-toolkit \--create-namespace \--values rollout/values-analysis.yaml \--set ingress.host=devops-toolkit.$ISTIO_HOST.nip.io \--set image.tag=2.6.2 \--wait# If Minikubehelm upgrade --install \devops-toolkit helm \--namespace devops-toolkit \--create-namespace \--values rollout/values-analysis.yaml \--set image.tag=2.6.2 \--waitkubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# Go to the second terminal# If not Minikubewhile true; docurl -I http://devops-toolkit.$ISTIO_HOST.nip.io/this-does-not-existsleep 1done# If Minikubewhile true; docurl -I -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST/this-does-not-exist"sleep 1done# Go to the first terminal sessionhelm upgrade devops-toolkit helm \--namespace devops-toolkit \--reuse-values \--set image.tag=2.9.9kubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# Go to the second terminal session# If NOT Minikubewhile true; docurl -I http://devops-toolkit.$ISTIO_HOST.nip.iosleep 1done# If Minikubewhile true; docurl -I -H "Host: devopstoolkitseries.com" \"http://$ISTIO_HOST"sleep 1donehelm upgrade devops-toolkit helm \--namespace devops-toolkit \--reuse-values \--set image.tag=2.9.17kubectl argo rollouts \--namespace devops-toolkit \get rollout devops-toolkit-devops-toolkit \--watch# Stop the rollout and loops in both terminals# Go to the first terminal session###################### What Happens Now? ######################kubectl delete namespace devops-toolkitkubectl delete namespace argo-rolloutskubectl delete namespace monitoringcd ..
Get hands-on with 1200+ tech skills courses.