• 周五. 7月 1st, 2022

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

K8s 常用命令(随时更新……)

admin

11月 28, 2021
1.创建deployment
kubectl create -f nginx-deployment.yaml

2.查看deployment
kubectl get deployment

3.查看Pod
kubectl get pod -o wide

4.测试Pod访问
curl --head 10.2.83.17

5.更新Deployment
kubectl set image deployment/nginx-deployment nginx=nginx:1.14.2 --record

6.查看更新后的Deployment
kubectl get deployment -o wide

7.查看更新历史
kubectl rollout history deployment/nginx-deployment

  查看升级状态
kubectl rollout status deployment/nginx-deployment

8.查看具体某一个版本的升级历史
kubectl rollout history deployment/nginx-deployment --revision=1

9.快速回滚到上一个版本
kubectl rollout undo deployment/nginx-deployment

10.扩容到5个节点
kubectl scale deployment nginx-deployment --replicas 5
 
11.查看dployment完整过程
kubectl describe deployment
 
12.删除deployment
kubectl delete deployment  nginx-deployment

13.查看service
kubectl get service

14.查看当前集群组件状态
kubectl get cs

15.查看kube-system命名空间里的服务
kubectl get deployment -n kube-system
kubectl get service -n kube-system

16.查看kube-system命名空间里所有服务
kubectl get all -n kube-system

17.查看所有节点状态
kubectl get nodes

18. 扩容pod
kubectl scale rc nginx-rc --replicas=5

19. 滚动更新nginx版本
kubectl rolling-update nginx-rc --image=192.168.56.80/devopsedu/nginx:1.14.0

发表评论

您的电子邮箱地址不会被公开。