diff --git a/k8s/ROLLOUTS.md b/k8s/ROLLOUTS.md new file mode 100644 index 0000000000..aa7bde5b9f --- /dev/null +++ b/k8s/ROLLOUTS.md @@ -0,0 +1,60 @@ +## Argo Rollouts Setup +### Installation verification +```bash +kubectl argo rollouts version +``` +```text +kubectl-argo-rollouts: v1.9.0+838d4e7 + BuildDate: 2026-03-20T21:08:11Z + GitCommit: 838d4e792be666ec11bd0c80331e0c5511b5010e + GitTreeState: clean + GoVersion: go1.24.13 + Compiler: gc + Platform: linux/amd64 +``` + +### Dashboard access +![Dashboard](/k8s/screenshots/argo_rollout_dashboard.png) + +## Canary Deployment +### Strategy configuration explained +The strategy gradually increases the weight of the new version (ratio). If I notice some issue, I have the chance to +abort the rollout. + +### Step-by-step rollout progression (screenshots from dashboard) +![Steps](/k8s/screenshots/argo_rollout_steps.png) + +Changed the tag to latest, paused at weight 20: + +![20](/k8s/screenshots/argo_rollout_pause_20.png) + +### Promotion and abort demonstration + +Pressed abort: + +![Abort](/k8s/screenshots/argo_rollout_aborted.png) + +Pressing "Promote" would just eventually replace all pods with the "latest" pods. + +## Blue-Green Deployment +### Strategy configuration explained +I added a new service with the "-preview" suffix (`roll-dinfochart-preview`). The strategy reflects that. + +### Preview vs active service +They are identical in my configuration, but all are working. + +### Promotion process +```bash +kubectl argo rollouts promote roll-dinfochart +``` +```text +rollout 'roll-dinfochart' promoted +``` + +## Strategy Comparison +### When to use canary vs blue-green +Canary is useful when there are no resources to host twice as many containers, or it is fine to test the new version on +a subset of users in production. + +Blue-green is useful when we need to launch a new version (tested) and switch the service to the new one with no +downtime because it immediately re-routes traffic to the new version. diff --git a/k8s/dinfochart/templates/rollout.yaml b/k8s/dinfochart/templates/rollout.yaml new file mode 100644 index 0000000000..09f1d1d979 --- /dev/null +++ b/k8s/dinfochart/templates/rollout.yaml @@ -0,0 +1,60 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + name: {{ include "dinfochart.fullname" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "dinfochart.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "dinfochart.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + vault.hashicorp.com/agent-inject: "true" + vault.hashicorp.com/role: "dinfoservice-role" + vault.hashicorp.com/agent-inject-secret-config: "secret/data/myapp/config" + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + ports: + - containerPort: {{ .Values.service.port }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: app-config + mountPath: /config + readOnly: true + - name: data-volume + mountPath: /data + envFrom: + - configMapRef: + name: {{ include "dinfochart.fullname" . }}-env + volumes: + - name: app-config + configMap: + name: {{ include "dinfochart.fullname" . }}-config + - name: data-volume + persistentVolumeClaim: + claimName: {{ include "dinfochart.fullname" . }}-data + strategy: + blueGreen: + activeService: {{ include "dinfochart.fullname" . }} + previewService: {{ include "dinfochart.fullname" . }}-preview + autoPromotionEnabled: false # Manual promotion + # autoPromotionSeconds: 30 # Or auto-promote after 30s diff --git a/k8s/dinfochart/templates/service-preview.yaml b/k8s/dinfochart/templates/service-preview.yaml new file mode 100644 index 0000000000..fc0547cb7b --- /dev/null +++ b/k8s/dinfochart/templates/service-preview.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dinfochart.fullname" . }}-preview + labels: + {{- include "dinfochart.labels" . | nindent 4 }} +spec: + type: NodePort + selector: + {{- include "dinfochart.selectorLabels" . | nindent 4 }} + ports: + - protocol: TCP + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} diff --git a/k8s/screenshots/argo_rollout_aborted.png b/k8s/screenshots/argo_rollout_aborted.png new file mode 100644 index 0000000000..83773658a2 Binary files /dev/null and b/k8s/screenshots/argo_rollout_aborted.png differ diff --git a/k8s/screenshots/argo_rollout_dashboard.png b/k8s/screenshots/argo_rollout_dashboard.png new file mode 100644 index 0000000000..04a1819674 Binary files /dev/null and b/k8s/screenshots/argo_rollout_dashboard.png differ diff --git a/k8s/screenshots/argo_rollout_pause_20.png b/k8s/screenshots/argo_rollout_pause_20.png new file mode 100644 index 0000000000..2bf96276e0 Binary files /dev/null and b/k8s/screenshots/argo_rollout_pause_20.png differ diff --git a/k8s/screenshots/argo_rollout_steps.png b/k8s/screenshots/argo_rollout_steps.png new file mode 100644 index 0000000000..5216e2f45d Binary files /dev/null and b/k8s/screenshots/argo_rollout_steps.png differ