K8s常用命令【交接版】

kubectl get pods --all-namespaces
获取k8s全部服务

kubectl logs chamb-hwms-inv-3c1de-584db57787-skhn7 -n chamb-wms-dev -f --tail 0
实时查看wms-dev日志

kubectl -n chamb-wms-dev logs chamb-hwms-inv-3c1de-584db57787-skhn7 > wms-dev0805.log
保存服务日志

k8s命令:
kubectl get ns
获取命名空间,可以使用 kubectl get namespaces 或者 kubectl get ns

查看所有命名空间运行的pod信息: kubectl get pods -A

[root@master ~]# kubectl get pods -A

NAMESPACE      NAME                             READY   STATUS    RESTARTS   AGE
kube-flannel   kube-flannel-ds-7clld            1/1     Running   0          5h35m
kube-flannel   kube-flannel-ds-psgvb            1/1     Running   0          5h35m
kube-flannel   kube-flannel-ds-xxncr            1/1     Running   0          5h35m
kube-system    coredns-6f6b8cc4f6-lbvl5         1/1     Running   0          5h45m
kube-system    coredns-6f6b8cc4f6-m6brz         1/1     Running   0          5h45m
kube-system  

你可能感兴趣的:(kubernetes,docker,容器)