kubectl create
kubectl rollout
kubectl edit
kubectl set
kubectl scale
1、创建与配置文件解析




2、deploy 滚动更新 :template 里面的内容改变触发滚动更新
编辑该 deploy 的 配置文件 ,加入一个 label

不会触发滚动更新
改变 nginx镜像版本


再次查看 deploy 信息 generation 变成 2 (初始是1)
升级步骤:



始终保持有 足够数量的 服务在运行
创建指定版本的 nginx deploy

改变镜像的版本后 查看滚定更新的 状态
修改 deploy 资源配置文件的两种方式
1、kubectl edit deploy gyk-nginx
2、 kubectl set image(key) deploy/gyk-nginx (resource type and name) nginx=nginx[tag]


3、滚动更新与 并发
如图所示、滚动更新的过程是 【 增加一个新的、创建一个老的】这样一步步来的、如果在【滚动更新的过程中】再次出发更新、则之前的【更新取消】、重新走新的更新方案
4、更新的回滚
k8s会对我们的更新历史进行记录
查看某个 deploy 的更新记录
kubectl rollout history deploy/gyk-nginx


第一个是 nginx1.25.5版本 、第二个是 nginx 最新版本、加 --revision 查看改变的具体位置



再次修改版本号:
kubectl set image deploy/gyk-nginx nginx=nginx:1.7.9



获取 所有 replicaSet

5、扩容和缩容


6、暂停与恢复

kubectl rollout pause deploy gyk-nginx
后续对 template 内容修改不会触发 更新
kubectl rollout resume deploy gyk-nginx
恢复对 replicas 的更新