KUBERNETES DEPLOYMENT

Deployments

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: webserver
spec:
replicas: 3
selector:
matchLabels:
app: web1
template:
metadata:
labels:
app: web1
spec:
containers:
- name: nginx-container
image: nginx:1.21.6
$ kubectl describe deployment nginx-deployment
$ kubectl get rs
$ kubectl scale --replicas=2 deploy nginx-deployment
$ kubectl log -f <podName>
# To check out rollout status
$kubectl rollout status deployment nginx-deployment
# Check all revision history
$kubectl rollout history deployment nginx-deployment
# To Rollback to previous version
$kubectl rollout undo deploy/nginx-deployment
# To Rollback to specific version
$kubectl rollout undo deploy/nginx-deployment --to-revision=<<version>>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store