Configuration Techniques
Rollout Configuration Strategies
1. RollingUpdate Configuration
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
Parameters Explanation
| Parameter |
Description |
Default |
| maxSurge |
Maximum number of pods that can be created above desired count |
25% |
| maxUnavailable |
Maximum number of pods that can be unavailable during update |
25% |
Deployment Update Techniques
Blue-Green Deployment
graph LR
A[Blue Environment] -->|Switch Traffic| B[Green Environment]
B -->|Rollback if Needed| A
Canary Deployment Configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: canary-deployment
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
Advanced Configuration Options
Health Checks and Readiness Probes
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 3
Rollout Command Examples
## Check rollout status
kubectl rollout status deployment/my-app
## Pause ongoing rollout
kubectl rollout pause deployment/my-app
## Resume paused rollout
kubectl rollout resume deployment/my-app
Rollback Mechanisms
Manual Rollback
## Rollback to previous revision
kubectl rollout undo deployment/my-app
## Rollback to specific revision
kubectl rollout undo deployment/my-app --to-revision=2
LabEx Tip
LabEx recommends practicing these configuration techniques in controlled environments to build practical Kubernetes skills.
Best Practices
- Use declarative configuration
- Implement comprehensive health checks
- Configure appropriate update strategies
- Monitor deployment progress
- Have a robust rollback plan