自学k8s-常见调试命令

kubectl describe <resource type> <resource name>
显示资源详细信息


kubectl get events
显示kubernetes 系统中最近的一些事件


kubectl get <resource type> <resource name> -o yaml
以yaml格式详细输出资源信息


kubectl logs -f <pod name> <container name>
持续输出容器中主进程的log,类似于docker logs


kubectl exec -it <pod name> --container <container name> -- <command>
在容器中执行命令,类似于docker exec


kubectl run -it -rm --restart=Never busybox --image=busybox sh
启动一个临时pod,并直接登录到pod中,常用来调试网络


kubectl attach <pod name> -c <container name> -it
类似于docker attach 加入到一个现有容器的console中

原文地址:https://www.cnblogs.com/potato-chip/p/13933678.html