K8S常用命令

常用命令

查看所有命令空间

kubectl get ns

查看当前命名空间

kubectl config view --minify --output 'jsonpath={..namespace}'

查看命名空间详情

kubectl describe ns xxxx

查看所有ingress

kubectl get ing
kubectl get ingress
kubectl get ing -o wide --show-labels

查看ingress详情

kubectl describe ing xxx

查看所有的service

kubectl get svc
kubectl get service
kubectl get svc -o wide --show-labels

查看service详情

kubectl describe svc xxx

查看所有pod

kubectl get po
kubectl get pod
kubectl get pods
kubectl get po -o wide --show-labels

查看pod详情

kubectl describe pod xxx

进入pod内部

kubectl exec -it xxx bash
kubectl exec -it xxx sh

查看pod最后n行日志

kubectl logs -f xxxx-podname --tail=100

//100就是从最后100行开始输出

导出yaml文件

kubectl get deployment my-deployment -o yaml
kubectl get svc xxx -o yaml

 

 

 



  • 随机毒鸡汤:最近一个月,总有那么三十天很不顺。

    A close-up shot of a person coding on a laptop, focusing on the hands and screen.

THE END