| 公网ip | 
内网eth0 ip | 
角色 | 
系统版本 | 
| 180.76.150.184 | 
172.18.0.111 | 
master | 
CentOS 7.3.1611 (Core) | 
| 180.76.114.227 | 
172.18.0.109 | 
node1 | 
CentOS 7.3.1611 (Core) | 
| 180.76.164.183 | 
172.18.0.110 | 
node2 | 
CentOS 7.3.1611 (Core) | 
管理应用程序生命周期 master执行
1.创建kubectl run nginx --replicas=3 --image=nginx:1.14 --port=80kubectl get deploy,pods2.发布(暴露)kubectl expose deployment nginx --port=80 --type=NodePort --target-port=80 --name=nginx-servicekubectl get service[root@instance-fq0043cl-3 ~]# kubectl get serviceNAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGEkubernetes      ClusterIP   10.96.0.1        <none>        443/TCP        112dnginx           NodePort    10.110.204.160   <none>        80:30179/TCP   110dnginx-cmdb      NodePort    10.110.204.170   <none>        81:30180/TCP   109dnginx-service   NodePort    10.110.91.64     <none>        80:32003/TCP   3s#浏览器访问任意node的公网ip+32003,即可访问刚才创建nginx3.更新kubectl set image deployment/nginx nginx=nginx:1.15#查看镜像的信息是否是1.14[root@instance-fq0043cl-3 ~]# kubectl describe pod nginx-w-997f65bb9-5sxcz[root@instance-fq0043cl-3 ~]# kubectl set image deployment/nginx nginx=nginx:1.15deployment.extensions/nginx image updated#k8s不会立即所有的立刻更新,会一个个容器的更新.4.回滚#查看所有的历史更新kubectl rollout history deployment/nginx#undo直接回滚上一个版本kubectl rollout undo deployment/nginx5.删除kubectl delete deploy/nginxkubectl delete svc/nginx-service