kubernetes部署全生命周期实践(一)
- 1.部署应用
kubectl run kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080
- 2.映射外部可以访问的端口
kubectl expose deployment kubernetes-bootcamp --type="NodePort" --port 8080
- 3.查看服务
kubectl get services
- 4.scale应用
- 4.1查看副本数
kubectl get deployments
- 4.2 扩展副本数
kubectl scale deployment kubernetes-bootcamp --replicas=3
- 4.3 scale down 副本
kubectl scale deployments/kubernetes-bootcamp --replicas=2
- 5.滚动更新
- 5.1 升级
kubectl set image deployment kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
- 5.2 回退
kubectl rollout undo deployments/kubernetes-bootcamp
原文地址:http://blog.51cto.com/huwho/2342956
时间: 2024-10-08 23:34:53