kubernetes rollback to previous deployment code example
Example 1: k8s roll back to previous deployment
kubectl rollout undo deployment/app --to-revision=2
Example 2: k8s roll back to previous deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
spec:
replicas: 3
revisionHistoryLimit: 100
selector:
matchLabels:
name: app
template:
metadata:
labels:
name: app
spec:
containers:
- name: app
image: learnk8s/hello:1.0.0