1. 获取所有的namespace
kubectl get namespaces
kubectl get pods --all-namespaces
kubectl get pods -A
kubectl get pods --namespace=shop
2. 部署nginx到shop中
kubectl run nginx --image=nginx --namespace=shop
3. 通过label查询pods
kubectl get pods --namespace=shop -l "app=user-service"
https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/labels/
4. 查看pod的日志
kubectl logs --namespace=shop -l "app=user-service"
5. 查看pods更多的详细信息
kubectl get pods --namespace=shop -l "app=user-service" -o wide
6. 更多的pods相关的命令
https://kubernetes.io/docs/reference/kubectl/generated/kubectl_get/
https://kubernetes.io/zh-cn/docs/reference/kubectl/cheatsheet/