5.k8s基本命令汇总

1. Deployment创建和删除

创建Deployment
kubectl create -f test.yaml

删除Deployment
kubectl delete -f test.yaml
kubectl delete deployments  *** -n --all-namespaces

查看Deployment
kubectl get deployments --all-namespaces

2. Service的创建查看

查看
kubectl get services --all-namespaces

创建
kubectl create -f test.yaml

删除
kubectl delete service *** -n default

3. pod的查看,删除

# pod的查看
kubectl get pod --all-namespaces
kubectl get pod --all-namespaces -o wide (查看更多的信息)
# 查看具体某一个mod的信息
kubectl describe pod **** -n kube-system

# 删除pod
kubectl delete pod **** -n kube-system

4. 查看k8s日志

journalctl -f -u kubelet.service

5. 查看pod节点的状态

kubectl describe pod kube-flannel-ds-amd64-zfkgl -n kube-system
原文地址:https://www.cnblogs.com/ITPower/p/12820596.html