#Kubernetes# 速查手册:常用 Kubernetes 命令

#Kubernetes# 速查手册:常用 Kubernetes 命令

覆盖在学习和工作中的常用 Kubernetes 命令:Node / Pod / Deployment / Service / Configmap / Storage / Network


目录 Table of Contents


Node

查看

1
2
kubectl get nodes | grep ${node_name}
kubectl describe node ${node_name}

Pod

查看

1
2
kubectl get pods | grep ${pod_name}
kubectl describe pod ${pod_name}

执行

1
kubectl exec -it ${pod_name} -c ${container_name} ${command}

删除

1
2
# 只删除 pod 不删除 deployment,相当于再重启
kubectl delete pod ${pod_name}

Deployment

查看

1
2
kubectl get deployments | grep ${deployment_name}
kubectl describe deployment ${deployment_name}

修改

1
2
3
4
# 保存后会直接生效
kubectl edit deployment ${deployment_name}

kubectl set image deployment/${deployment_name} ${container_name}=${registry}:${tag}

Service

查看

1
2
kubectl get services | grep ${service_name}
kubectl describe service ${service_name}

Configmap

查看

1
2
kubectl get configmaps | grep ${configmap_name}
kubectl describe configmap ${configmap_name}

修改

1
2
# 需重启后才会生效
kubectl edit configmap ${configmap_name}

Storage

  • To be continued…

Network

  • To be continued…

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×