k8s常用命令
程序员文章站
2022-03-12 12:20:49
...
#delete all failed pods
kubectl get pods --all-namespaces --field-selector 'status.phase'=Failed" -o json | kubectl delete -f -
#get all stopped pods
kubectl get pods --all-namespaces --field-selector=status.phase!=Running
#wc -l get the number of previous output items
kubectl get pods --all-namespaces --field-selector=status.phase!=Running | wc -l
#get status of all pods by namespaces
kubectl describe pods -n ****
#get master server cluster-info
kubectl cluster-info
#display recent 20 lines of nginx pod output
kubectl logs --tail=20 nginx
#show all logs from nginx pod written in last hour
kubectl logs --since=1h nginx
#resolve memory leaking in node
#1. cancle all schedule in one node
kubectl drain {node_to_reschedule} --ignore-daemonsets
#2. recover it
kubectl uncordon {node_rescheduled}
#3. get all nodes to check the schedule info
kubectl get nodes
上一篇: docker(一) 基本操作
下一篇: Docker基本操作