k8s 回滚
查看当前有哪些版本,可以看到1和2[root@k8s-master-61 ~]# kubectl rollout history deployment/scm-admin -n java-test2deployment.apps/scm-adminREVISIONCHANGE-CAUSE1<none>2<none>查看版本1[root@k8s-master-61 ~]# k
·
查看当前有哪些版本,可以看到1和2
[root@k8s-master-61 ~]# kubectl rollout history deployment/scm-admin -n java-test2
deployment.apps/scm-admin
REVISION CHANGE-CAUSE
1 <none>
2 <none>
查看版本1
[root@k8s-master-61 ~]# kubectl rollout history deployment/scm-admin -n java-test2 --revision=1
deployment.apps/scm-admin with revision #1
Pod Template:
Labels: app=scm-admin
pod-template-hash=844d49f654
Containers:
scm-admin:
Image: 10.1.1.247/datacenter/scm-admin:master-2021-07-08
Port: 9015/TCP
Host Port: 0/TCP
Limits:
cpu: 1
memory: 1Gi
Requests:
cpu: 500m
memory: 500Mi
Environment: <none>
Mounts:
/usr/share/zoneinfo/Asia/Shanghai from date (ro)
Volumes:
date:
Type: HostPath (bare host directory volume)
Path: /etc/localtime
HostPathType:
版本2
[root@k8s-master-61 ~]# kubectl rollout history deployment/scm-admin -n java-test2 --revision=2
deployment.apps/scm-admin with revision #2
Pod Template:
Labels: app=scm-admin
pod-template-hash=78769698bf
Containers:
scm-admin:
Image: 10.1.1.247/datacenter/scm-admin:master-2021-07-12
Port: 9015/TCP
Host Port: 0/TCP
Limits:
cpu: 1
memory: 1Gi
Requests:
cpu: 500m
memory: 500Mi
Environment: <none>
Mounts:
/usr/share/zoneinfo/Asia/Shanghai from date (ro)
Volumes:
date:
Type: HostPath (bare host directory volume)
Path: /etc/localtime
HostPathType:
我们可以看到当前处于版本2,现在我们回滚到版本1
[root@k8s-master-61 ~]# kubectl rollout undo deployment/scm-admin -n java-test2 --to-revision=1
deployment.apps/scm-admin rolled back
现在默认创建3 ,也就是之前的1
[root@k8s-master-61 ~]# kubectl get pods -n java-test2
NAME READY STATUS RESTARTS AGE
busybox-548b94bcd4-5p796 1/1 Running 93 3d22h
scm-admin-844d49f654-7xg6z 1/1 Running 0 58s
scm-admin-844d49f654-g9khj 1/1 Running 0 60s
scm-finance-88fd7d86f-nxhkt 1/1 Running 0 4d3h
scm-log-665c8689bb-p5cvj 1/1 Running 0 3d23h
scm-open-6c99d97878-ttc4k 0/1 ImagePullBackOff 0 4d
scm-purchase-f6b577b86-cpmz4 1/1 Running 0 3d23h
scm-report-669b5bdd87-j652f 1/1 Running 0 3d23h
scm-stock-84846575c9-rww2g 1/1 Running 0 4d3h
scm-system-55f7dbbcff-fnjtk 1/1 Running 0 4d3h
scm-tenant-556865887-skt78 1/1 Running 0 4d3h
scm-warehouse-99d7dc885-6jpqb 1/1 Running 0 4d3h
supply-user-5c845b6846-69k24 1/1 Running 0 3d3h
[root@k8s-master-61 ~]# kubectl rollout history deployment/scm-admin -n java-test2
deployment.apps/scm-admin
REVISION CHANGE-CAUSE
2 <none>
3 <none>
默认回滚到上一个版本,不指定--to-revision=? 则默认回滚到上一版本
[root@k8s-master-61 ~]# kubectl rollout undo deployment/scm-admin -n java-test2
deployment.apps/scm-admin rolled back
revisionHistoryLimit:3 保留3个版本
更多推荐
已为社区贡献29条内容
所有评论(0)