其他分享
首页 > 其他分享> > k8s扩容和缩容 (指定–replicas的数量)

k8s扩容和缩容 (指定–replicas的数量)

作者:互联网

1.查看原pod容器数量

[root@master-01 ~]# kubectl get pod
NAME                                READY     STATUS    RESTARTS   AGE
nginx-deployment-6b47cf4878-8mjkr   1/1       Running   0          1m
nginx-deployment-6b47cf4878-kr978   1/1       Running   0          1m
nginx-deployment-6b47cf4878-tvhvl   1/1       Running   0          1m

2.增加pod数量

[root@master-01 ~]# kubectl scale deploy/nginx-deployment --replicas=5
deployment.extensions "nginx-deployment" scaled

3.查看现在pod容器数量

[root@master-01 ~]# kubectl get pod
NAME                                READY     STATUS              RESTARTS   AGE
nginx-deployment-6b47cf4878-6r5dz   0/1       ContainerCreating   0          4s
nginx-deployment-6b47cf4878-7sjtt   0/1       ContainerCreating   0          4s
nginx-deployment-6b47cf4878-8mjkr   1/1       Running             0          2m
nginx-deployment-6b47cf4878-kr978   1/1       Running             0          2m
nginx-deployment-6b47cf4878-tvhvl   1/1       Running             0          2m

标签:缩容,6b47cf4878,replicas,nginx,Running,01,deployment,pod,k8s
来源: https://www.cnblogs.com/lfl17718347843/p/13972451.html