滚动升级、回退镜像实例

[root@lab2 dandang]# kubectl set image replicationcontroller/dandang dandang=10.1.1.71:5000/library/dandang.ceshi:v2 -n development
[root@lab2 dandang]# kubectl set image replicationcontroller/dandang dandang=10.1.1.71:5000/library/dandang.ceshi:v1 -n development
replicationcontroller/dandang image updated



1、升级镜像

[root@lab2 dandang]# ls
dandang.v1.yaml  dandang.v2.yaml

[root@lab2 dandang]# kubectl get deploy -n development
NAME                  DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
nginx1-7-deployment   2         2         2            2           4d
nginx1-8-deployment   2         2         2            2           4d
traefik-ingress-lb    1         1         1            1           4d

[root@lab2 dandang]# cat dandang.v2.yaml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: dandang
  namespace: development
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: dandang
    spec:
      containers:
      - name: dandang
        image: 10.1.1.71:5000/library/dandang.ceshi:v2
        ports:
        - containerPort: 8080

[root@lab2 dandang]# kubectl get ReplicationController -n development
NAME      DESIRED   CURRENT   READY     AGE
dandang   1         1         1         22h
mysql     1         1         1         3d
redis     1         1         1         3d

[root@lab2 dandang]# kubectl set image replicationcontroller/dandang dandang=10.1.1.71:5000/library/dandang.ceshi:v2 -n development
replicationcontroller/dandang image updated




2、回退镜像


回滚到上一个版本:

[root@lab2 dandang]# kubectl set image replicationcontroller/dandang dandang=10.1.1.71:5000/library/dandang.ceshi:v1 -n development
replicationcontroller/dandang image updated

 

posted @ 2019-03-26 09:04  effortsing  阅读(575)  评论(0编辑  收藏  举报