argocd rollout basic setup

First we are going to need the following files and apply them 

apiVersion: v1
kind: Service
metadata:
  name: rollouts-demo
spec:
  ports:
  - port: 80
    targetPort: http
    protocol: TCP
    name: http
  selector:
    app: rollouts-demo

And this is the rollout file and notice the image we are using is 'blue

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollouts-demo
spec:
  replicas: 5
  strategy:
    canary:
      steps:
      - setWeight: 20
      - pause: {}
      - setWeight: 40
      - pause: {}
      - setWeight: 60
      - pause: {}
      - setWeight: 80
      - pause: {}
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: rollouts-demo
  template:
    metadata:
      labels:
        app: rollouts-demo
    spec:
      containers:
      - name: rollouts-demo
        image: argoproj/rollouts-demo:blue
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
        resources:
          requests:
            memory: 32Mi
            cpu: 5m

Next we run this command to see what is that status now:

kubectl argo rollouts get rollout rollouts-demo --watch


Changing our image to yellow (yellow)

kubectl argo rollouts set image rollouts-demo rollouts-demo=argoproj/rollouts-demo:yellow

So the syntax for this command is here

kubectl argo rollouts set image my-rollout containerName=imageName

As you can see here (from our rollout yaml too) that we have configure our rollout to be canary with indefinite wait. The pod under canary mode image has been updated to yellow. 

Here we can see 


Lets promote our rollout 

kubectl argo rollouts promote rollouts-demo

And you can see we have a slightly different pod setup and our second pod has been update to use yellow image as seen here. 




To show how an abortion works, let's do this - lets promote this to 'red'

kubectl argo rollouts set image rollouts-demo \ rollouts-demo=argoproj/rollouts-demo:red

And then we will abort 

kubectl argo rollouts abort rollouts-demo

We now have all 5 pods running yellow image but in degraded state.


To fix this we need to run. I wish there is a short cut command to go previous. 

kubectl argo rollouts set image rollouts-demo \ rollouts-demo=argoproj/rollouts-demo:yellow


If you get the rollout status here, you will see that our deployment gets updated:-

kubectl argo rollouts get rollout rollouts-demo -watch 


 




Comments

Popular posts from this blog

vllm : Failed to infer device type

android studio kotlin source is null error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20