标签:clean com container 管理 for stat nta comm build
[root@master ~]# kubectl get nodes 查看集群节点
NAME STATUS AGE
node1 Ready 25m
node2 Ready 19m
[root@master ~]# kubectl version 查看版本
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
[root@master ~]# kubectl run nginx --image=docker.io/nginx --replicas=1 --port=9000
deployment "nginx" created
[root@master ~]# kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
nginx 1 1 1 0 15s
[root@master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-2187705812-8r0h4 1/1 Running 0 1h
[root@master ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE
nginx-2187705812-8r0h4 1/1 Running 0 1h 10.255.4.2 node1
想要删除一个容器的时候:
[root@master ~]# kubectl delete pod nginx-2187705812-8r0h4
pod "nginx-2187705812-8r0h4" deleted
[root@master ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-2187705812-6dn2r 0/1 ContainerCreating 0 4s
删除了之后还依然有,这个是因为创建deployment的时候参数--replicas=1起作用了。想要删除的话直接删除deployment就可以了。
[root@master ~]# kubectl delete deployment nginx
deployment "nginx" deleted
yaml语法:
标签:clean com container 管理 for stat nta comm build
原文地址:https://www.cnblogs.com/winter1519/p/10015420.html