Deployment的伸缩扩容

1.扩容

[root@k8s-master01 ~]# kubectl scale  --replicas=3 deploy nginx
deployment.apps/nginx scaled
[root@k8s-master01 ~]# kubectl get po
NAME                     READY   STATUS              RESTARTS   AGE
nginx-6cdd5dd489-bs5wz   1/1     Running             0          10m
nginx-6cdd5dd489-lmw86   0/1     ContainerCreating   0          30s
nginx-6cdd5dd489-n8xv9   1/1     Running             0          11m

2.缩容

[root@k8s-master01 ~]# kubectl get po
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-bs5wz   1/1     Running   0          11m
nginx-6cdd5dd489-lmw86   1/1     Running   0          85s
nginx-6cdd5dd489-n8xv9   1/1     Running   0          12m
[root@k8s-master01 ~]# kubectl scale --replicas=2 deploy nginx
deployment.apps/nginx scaled
[root@k8s-master01 ~]# kubectl get po
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-bs5wz   1/1     Running   0          12m
nginx-6cdd5dd489-n8xv9   1/1     Running   0          13m
原文地址:https://www.cnblogs.com/Applogize/p/14383549.html