功能说明 命令
node
查看服务器节点 kubectl get nodes
查看服务器节点详情 kubectl get nodes -o wide
节点打标签 kubectl label nodes <节点名称> labelName=<标签名称>
查看节点标签 kubectl get node --show-labels
删除节点标签 kubectl label node <节点名称> labelName-
查看node详细信息 kubectl describe node +节点名称
删除node kubectl delete node +节点名称
pod
查看pod节点 kubectl get pod
查看pod节点详情 kubectl get pod -o wide
查看pod详细信息 kubectl describe po
查看pod日志 kubectl logs -f
查看所有pod kubectl get pod --all-namespaces
根据yaml文件创建pod kubectl apply -f <文件名称>
根据yaml文件删除pod kubectl delete -f <文件名称>
删除pod节点 kubectl delete pod
查看异常的pod节点 kubectl get pods -n <名称空间> | grep -v Running
查看异常pod节点的日志 kubectl describe pod
进入pod kubectl exec -it
svc
查看服务 kubectl get svc
查看服务详情 kubectl get svc -o wide
查看所有名称空间下的服务 kubectl get svc --all-namespaces
对k8s相关配置项的操作
查看所有配置项列表 kubectl get cm --all-namespaces
查看某个配置项详情 kubectl get cm -n
编辑某个配置项的内容,修改后需要重启pod kubectl edit cm -n