[root@aniu-k8s guestbook]# kubectl scale deployment frontend --replicas=2
deployment "frontend" scaled
[root@aniu-k8s guestbook]# kubectl get pods
NAME READY STATUS RESTARTS AGE
frontend-67f65745c-lr25s 1/1 Running 0 50m
frontend-67f65745c-n798g 1/1 Running 0 50m
frontend-67f65745c-n92r4 0/1 Terminating 0 50m
frontend-67f65745c-spjnm 0/1 Terminating 0 45m
redis-master-585798d8ff-g69wc 1/1 Running 0 56m
redis-slave-865486c9df-tjvfn 1/1 Running 0 53m
redis-slave-865486c9df-x76gb 1/1 Running 0 53m
删除部署和服务也会删除任何正在运行的Pod。使用标签可以用一个命令删除多个资源。
运行以下命令删除所有Pod,Deployments和Services。
kubectl delete deployment -l app=redis
kubectl delete service -l app=redis
kubectl delete deployment -l app=guestbook
kubectl delete service -l app=guestbook
回显如下:
deployment "redis-master" deleted
deployment "redis-slave" deleted
service "redis-master" deleted
service "redis-slave" deleted
deployment "frontend" deleted
service "frontend" deleted
查询Pod的列表以验证没有Pod正在运行:
kubectl get pods
#
No resources found.
CentOS 7.3利用kubeadm安装Kubernetes 1.7.3完整版 https://www.linuxidc.com/Linux/2018-01/150517.htm
在Kubernetes集群中部署MySQL主从 https://www.linuxidc.com/Linux/2018-03/151282.htm
国内获取 Kubernetes 镜像的方法 https://www.linuxidc.com/Linux/2018-02/151015.htm
Kubernetes数据持久化方案 https://www.linuxidc.com/Linux/2018-03/151280.htm
Kubernetes集群配置笔记 https://www.linuxidc.com/Linux/2018-03/151136.htm