A Rollout is a type of Kubernetes workload resource that functions similarly to a Kubernetes Deployment object. It is designed to replace a Deployment in situations where more sophisticated deployment or progressive delivery capabilities are required. A Rollout offers several features that a standard Kubernetes Deployment does not provide:
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
values.yaml
file to customize the installation:
dashboard:
# -- Deploy dashboard server
enabled: true
# -- Set cluster role to readonly
readonly: true
# -- Value of label `app.kubernetes.io/component`
component: rollouts-dashboard
ingress:
enabled: true
annotations: {}
labels: {}
ingressClassName: "nginx"
hosts:
- ARGO-DASHBOARD-DOMAIN.COM # Replace with your domain
helm install argo-rollouts -n argo-rollouts argo/argo-rollouts -f values.yaml
curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
chmod +x ./kubectl-argo-rollouts-linux-amd64
sudo mv ./kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts
kubectl argo rollouts version
rollout.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: {{ include "my-app.fullname" . }}
namespace: {{ .Values.namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "my-app.fullname" . }}
template:
metadata:
labels:
app: {{ include "my-app.fullname" . }}
spec:
containers:
- name: {{ include "my-app.fullname" . }}-container
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
ports:
- containerPort: {{ .Values.containerPort }}
resources:
requests:
memory: 32Mi
cpu: 5m
strategy:
canary:
steps:
- setWeight: 20
- pause: {}
- setWeight: 40
- pause: {duration: 10}
- setWeight: 60
- pause: {duration: 10}
- setWeight: 80
- pause: {duration: 10}
revisionHistoryLimit: 2
service.yaml
apiVersion: v1
kind: Service
metadata:
name: {{ include "my-app.service.name" . }}
namespace: {{ .Values.namespace }}
spec:
selector:
app: {{ include "my-app.fullname" . }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
type: {{ .Values.service.type }}
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "my-app.fullname" . }}-ingress
namespace: {{ .Values.namespace }}
annotations:
kubernetes.io/ingress.class: nginx # Specify your ingress class if needed
spec:
ingressClassName: nginx
rules:
- host: {{ .Values.ingress.hostname }}
http:
paths:
- path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
service:
name: {{ include "my-app.service.name" . }}
port:
number: {{ .Values.service.port }}
kubectl apply -f rollout.yaml
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml
kubectl argo rollouts get rollout my-app
OR open dashboard in browser,
kubectl argo rollouts set image my-app my-app-container=argoproj/rollouts-demo:green
my-app
service by promoting it via the Argo Rollouts command.
kubectl argo rollouts promote my-app
Argo Rollouts provide a robust solution for managing Kubernetes deployments. By leveraging advanced deployment strategies like Canary deployments, you can ensure higher availability and reliability for your applications. Follow the steps outlined in this blog to implement a Canary deployment with Argo Rollouts, enhancing your deployment process and minimizing downtime.
Argo Rollouts is a powerful tool that, can significantly streamline your Kubernetes deployment workflows. Try it out and experience the benefits of advanced deployment strategies in your applications!