15. Kubernetes Deployments and Rolling Updates

Опубликовано: 01 Декабрь 2024
на канале: iMustLearn
257
0

** Example:1 **
vi my-nginx-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx-deployment-pod
labels:
app: mynginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
name: my-nginx-deployment-container
image: nginx
ports:
containerPort: 80

kubectl create -f my-nginx-deployment.yaml

kubectl get deployments

kubectl get pods -l app=nginx -o wide

kubectl edit deployment my-nginx-deployment-pod

***** change number of replicas to 5.
spec:
progressDeadlineSeconds: 600
replicas: 5
*****************

kubectl get pods -l app=nginx

kubectl get replicaset

kubectl scale deployment my-nginx-deployment-pod --replicas=3

kubectl get pods -l app=nginx