Cloud Intermediate
Kubernetes Deployment Strategies¶
KubernetesDeploymentRolling Update 3 min read
RollingUpdate, Recreate, Blue-Green and Canary in Kubernetes.
RollingUpdate¶
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1 # Max extra pods
maxUnavailable: 0 # Zero downtime
template:
spec:
containers:
- name: app
image: myapp:v2
Recreate¶
Deletes all pods and creates new ones. Has downtime, but simple for stateful apps.
Canary with Argo Rollouts¶
apiVersion: argoproj.io/v1alpha1
kind: Rollout
spec:
strategy:
canary:
steps:
- setWeight: 5
- pause: {duration: 5m}
- setWeight: 25
- pause: {duration: 10m}
- setWeight: 75
- pause: {duration: 5m}
Summary¶
RollingUpdate is the default and sufficient in most cases. For more sophisticated strategies, use Argo Rollouts.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.