kubectl查询日志命令
防水堡
bug日志定位命令:
docker logs --tail 100 xxx:xxx 是容器的id 或者名称
kubectl logs-f --tail 100 xxx:xxx 是pod 的id,如果的命名空间不一样就:kubectl -n yyy logs-f --tail 100 xxx ,yyy是命名空间
查找jupyter:kubectl get pod -n jhub
查找j具体upyter日志:kubectl logs jupyter-test4naff-2dexperiment -n jhub
过滤jupyter:kubectl get pod -n jhub |grep jupyter-test
过滤jupyter的第一列:kubectl get pod -n jhub |grep jupyter-test |awk '{print $1}'
循环批量删除jupyter:for i in `kubectl get pod -n jhub |grep jupyter-test |awk '{print $1}'`;do kubectl delete pod $i -n jhub --force --grace-period=0;done
查看jupyter的docker的CPU和内存占用情况:
kubectl describe node 192.168.50.36
kubectl exec -it jupyter-analyst-2dexperiment -n jhub sh
计算个数:kubectl get pod -n jhub|grep "jupyter" |grep "Running"|wc -l
获取节点:kubectl get node
获取节点状态:kubectl get pod -n business
获取节点挂载的主机:kubectl get pod -n business -o wide;kubectl top pod -n business
节点CPU,内存占用情况:kubectl top node
查看docker的id(到对应的node节点上):docker ps | grep api-gateway
所有docker的name:docker ps --format "{{.Names}}"