在Kubernetes集群中使用Redis部署PHP留言簿应用程序(5)

[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

清理pods及services

删除部署和服务也会删除任何正在运行的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

Kubernetes 的详细介绍请点这里
Kubernetes 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a1568808b388a24ca27f73cde970bf87.html