kubectl常用命令

(1)设置污点Taint

kubectl taint nodes <节点名称> key=value:NoSchedule

(2)删除污点

kubectl taint nodes <节点名称> key:NoSchedule-

(3)设置Roles

kubectl label nodes <节点名称> node-role.kubernetes.io/slave=

(4)去除Roles

kubectl label nodes <节点名称> node-role.kubernetes.io/slave-

(5)设置标签label

kubectl label nodes <节点名称> role=ingress

(6)驱逐节点上所有的POD

kubectl drain --ignore-daemonsets <节点名称>

(7)查看POD日志,当POD中存在多个容器时,需要用-c指定容器

kubectl log <POD名称> -c <容器名称> -n <命名空间>

(8)重启全部

sudo systemctl  restart  etcd  flanneld kube-nginx kube-apiserver kube-controller-manager kube-scheduler docker kubelet kube-proxy nginx-proxy

(9)镜像更新

kubectl set image deployment/<deployment-name> <container-name>=<new-image>

kubectl set image deployment/render-server render-server=registry-vpc.cn-huhehaote.aliyuncs.com/4dshoetech/render-server:xxx -n 4dtc