参考:https://kubernetes.io/docs/tutorials/kubernetes-basics/

更新应用程序

用户希望应用程序始终可用,开发人员每天需要部署几次新版本的应用程序。在Kubernetes中,这是通过滚动更新完成的。滚动更新允许部署的更新在零停机时间的情况下进行,方法是用新实例增量地更新Pods实例。新的PODS将安排在有可用资源的节点上。

步骤1:更新应用程序的版本

$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-bootcamp 4/4 4 4 2m4s
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-6bf84cb898-7fgv8 1/1 Running 0 2m1s
kubernetes-bootcamp-6bf84cb898-t9slq 1/1 Running 0 2m1s
kubernetes-bootcamp-6bf84cb898-tvlw7 1/1 Running 0 2m1s
kubernetes-bootcamp-6bf84cb898-zqfj6 1/1 Running 0 2m
$ kubectl describe pods
Name: kubernetes-bootcamp-6bf84cb898-7fgv8
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:12:34 +0000
Labels: pod-template-hash=6bf84cb898
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.4
Controlled By: ReplicaSet/kubernetes-bootcamp-6bf84cb898
Containers:
kubernetes-bootcamp:
Container ID: docker://8a63d8f20c262c6ac85509c068b98f3c75074ea51511734310616cc312a23c6d
Image: gcr.io/google-samples/kubernetes-bootcamp:v1 #镜像版本
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:0d6b8ee63bb57c5f5b6156f446b3bc3b3c143d233037f3a2f00e279c8fcc64af
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:12:35 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m24s default-scheduler Successfully assigned default/kubernetes-bootcamp-6bf84cb898-7fgv8 to minikube
Normal Pulled 2m24s kubelet, minikube Container image "gcr.io/google-samples/kubernetes-bootcamp:v1" already present on machine
Normal Created 2m24s kubelet, minikube Created container
Normal Started 2m23s kubelet, minikube Started container Name: kubernetes-bootcamp-6bf84cb898-t9slq
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:12:34 +0000
Labels: pod-template-hash=6bf84cb898
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.7
Controlled By: ReplicaSet/kubernetes-bootcamp-6bf84cb898
Containers:
kubernetes-bootcamp:
Container ID: docker://926024b884fc353705a542dcef5d6b3ddf0c0dd0c43ef32f1e95a95391f65175
Image: gcr.io/google-samples/kubernetes-bootcamp:v1
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:0d6b8ee63bb57c5f5b6156f446b3bc3b3c143d233037f3a2f00e279c8fcc64af
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:12:37 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m24s default-scheduler Successfully assigned default/kubernetes-bootcamp-6bf84cb898-t9slq to minikube
Normal Pulled 2m22s kubelet, minikube Container image "gcr.io/google-samples/kubernetes-bootcamp:v1" already present on machine
Normal Created 2m22s kubelet, minikube Created container
Normal Started 2m21s kubelet, minikube Started container Name: kubernetes-bootcamp-6bf84cb898-tvlw7
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:12:34 +0000
Labels: pod-template-hash=6bf84cb898
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.6
Controlled By: ReplicaSet/kubernetes-bootcamp-6bf84cb898
Containers:
kubernetes-bootcamp:
Container ID: docker://6e47947b7ce2d7295140e4d431901467a452e6e4fcb5226373cc237215831706
Image: gcr.io/google-samples/kubernetes-bootcamp:v1
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:0d6b8ee63bb57c5f5b6156f446b3bc3b3c143d233037f3a2f00e279c8fcc64af
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:12:37 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m25s default-scheduler Successfully assigned default/kubernetes-bootcamp-6bf84cb898-tvlw7 to minikube
Normal Pulled 2m23s kubelet, minikube Container image "gcr.io/google-samples/kubernetes-bootcamp:v1" already present on machine
Normal Created 2m22s kubelet, minikube Created container
Normal Started 2m21s kubelet, minikube Started container Name: kubernetes-bootcamp-6bf84cb898-zqfj6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:12:34 +0000
Labels: pod-template-hash=6bf84cb898
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.5
Controlled By: ReplicaSet/kubernetes-bootcamp-6bf84cb898
Containers:
kubernetes-bootcamp:
Container ID: docker://00cc46214182153a7eae9046041d5b3687c133799561064b0ee1bbaca7e48b11
Image: gcr.io/google-samples/kubernetes-bootcamp:v1 #镜像版本
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:0d6b8ee63bb57c5f5b6156f446b3bc3b3c143d233037f3a2f00e279c8fcc64af
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:12:37 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m24s default-scheduler Successfully assigned default/kubernetes-bootcamp-6bf84cb898-zqfj6 to minikube
Normal Pulled 2m23s kubelet, minikube Container image "gcr.io/google-samples/kubernetes-bootcamp:v1" already present on machine
Normal Created 2m22s kubelet, minikube Created container
Normal Started 2m21s kubelet, minikube Started container

若要将应用程序的映像更新为版本2,请使用set image 命令,然后是deployment 名称和 新镜像 版本:

$ kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
deployment.extensions/kubernetes-bootcamp image updated

该命令通知deployments为您的应用程序使用不同的映像,并启动滚动更新。并使用GET Pods命令查看新Pods的状态,之前的pods已经不存在:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-5bf4d5689b-2xcfb 1/1 Running 0 2m2s
kubernetes-bootcamp-5bf4d5689b-mrbb6 1/1 Running 0 2m4s
kubernetes-bootcamp-5bf4d5689b-rjpl6 1/1 Running 0 2m3s
kubernetes-bootcamp-5bf4d5689b-rq62d 1/1 Running 0 2m4s

  

步骤2:验证更新

首先,让我们检查应用程序是否正在运行。为了找出公开的IP和端口,我们可以使用describe service:

$ kubectl describe services/kubernetes-bootcamp
Name: kubernetes-bootcamp
Namespace: default
Labels: run=kubernetes-bootcamp
Annotations: <none>
Selector: run=kubernetes-bootcamp
Type: NodePort
IP: 10.111.214.229
Port: <unset> 8080/TCP
TargetPort: 8080/TCP
NodePort: <unset> 32217/TCP
Endpoints: 172.18.0.10:8080,172.18.0.11:8080,172.18.0.8:8080 + 1 more...
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>

创建一个名为Node_Port的环境变量,该变量的节点端口值为:

$ export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')
$ echo NODE_PORT=$NODE_PORT
NODE_PORT=32217

接下来,我们将对公开的IP和端口进行curl:

$ curl $(minikube ip):$NODE_PORT
Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-5bf4d5689b-mrbb6 | v=2

我们使用每个请求访问不同的Pod,我们看到所有的Pods都在运行最新版本(V2)。

还可以通过运行滚出状态命令来确认更新:

$ kubectl rollout status deployments/kubernetes-bootcamp
deployment "kubernetes-bootcamp" successfully rolled out

  

若要查看该应用程序的当前图像版本,请对Pods运行描述命令:

$ kubectl describe pods
Name: kubernetes-bootcamp-5bf4d5689b-2xcfb
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:44 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.11
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://7adbc5afbaa8d7763f17529f0b54731c003b7c114e2b0e6936a17b9b6406993a
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:45 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 10m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-2xcfb to minikube
Normal Pulled 10m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 10m kubelet, minikube Created container
Normal Started 10m kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-mrbb6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:42 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.9
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://49a606c599140f370953d2c5ecdfd56fe2149497635eaf650977376727fd1334
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 10m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-mrbb6 to minikube
Normal Pulled 10m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 10m kubelet, minikube Created container
Normal Started 10m kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-rjpl6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:43 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.10
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://147bc6dec7d9e8036e4d23c0eaad891216d1c67921052c7c3ee30263c0116c55
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 10m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-rjpl6 to minikube
Normal Pulled 10m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 10m kubelet, minikube Created container
Normal Started 10m kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-rq62d
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:42 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.8
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://ba622412c3b9350df9212c3b677d1560e1b7e37cb909c262ce73153e7ff99b2c
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 10m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-rq62d to minikube
Normal Pulled 10m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 10m kubelet, minikube Created container
Normal Started 10m kubelet, minikube Started container

步骤3:回滚更新

查看deployments的状态:

$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-bootcamp 3/4 2 3 23m

出了点问题…我们没有所需数量(available状态)的pods。再次列出Pods:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-597cfc5b76-bc46g 0/1 ImagePullBackOff 0 8m25s  #状态:镜像拉回,让我们把镜像还原回原来的版本。
kubernetes-bootcamp-597cfc5b76-gh76q 0/1 ImagePullBackOff 0 8m25s
kubernetes-bootcamp-5bf4d5689b-mrbb6 1/1 Running 0 21m
kubernetes-bootcamp-5bf4d5689b-rjpl6 1/1 Running 0 21m
kubernetes-bootcamp-5bf4d5689b-rq62d 1/1 Running 0 21m

存储库中没有名为V10的映像。让我们回到我们以前的工作版本。我们将使用rollout命令

$ kubectl rollout undo deployments/kubernetes-bootcamp
deployment.extensions/kubernetes-bootcamp rolled back

ROLLOUT命令将部署恢复到以前的已知状态(映像的v2版本)。更新是版本化的,您可以恢复到任何以前知道的部署状态。再次列出Pods:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-5bf4d5689b-j54m4 1/1 Running 0 3m10s
kubernetes-bootcamp-5bf4d5689b-mrbb6 1/1 Running 0 27m
kubernetes-bootcamp-5bf4d5689b-rjpl6 1/1 Running 0 27m
kubernetes-bootcamp-5bf4d5689b-rq62d 1/1 Running 0 27m

四个pods在运行。再次检查它们的映像:

$ kubectl describe pods
Name: kubernetes-bootcamp-5bf4d5689b-j54m4
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:43:21 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.6
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://8a6566c1233f5333585c7ca905509b754f7ac93e8b7eed4a2c0a699159486606
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:43:22 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 3m16s default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-j54m4 to minikube
Normal Pulled 3m15s kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 3m15s kubelet, minikube Created container
Normal Started 3m15s kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-mrbb6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:42 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.9
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://49a606c599140f370953d2c5ecdfd56fe2149497635eaf650977376727fd1334
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 27m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-mrbb6 to minikube
Normal Pulled 27m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 27m kubelet, minikube Created container
Normal Started 27m kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-rjpl6
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:43 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.10
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://147bc6dec7d9e8036e4d23c0eaad891216d1c67921052c7c3ee30263c0116c55
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 27m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-rjpl6 to minikube
Normal Pulled 27m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 27m kubelet, minikube Created container
Normal Started 27m kubelet, minikube Started container Name: kubernetes-bootcamp-5bf4d5689b-rq62d
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: minikube/172.17.0.54
Start Time: Tue, 09 Apr 2019 07:18:42 +0000
Labels: pod-template-hash=5bf4d5689b
run=kubernetes-bootcamp
Annotations: <none>
Status: Running
IP: 172.18.0.8
Controlled By: ReplicaSet/kubernetes-bootcamp-5bf4d5689b
Containers:
kubernetes-bootcamp:
Container ID: docker://ba622412c3b9350df9212c3b677d1560e1b7e37cb909c262ce73153e7ff99b2c
Image: jocatalin/kubernetes-bootcamp:v2
Image ID: docker-pullable://jocatalin/kubernetes-bootcamp@sha256:fb1a3ced00cecfc1f83f18ab5cd14199e30adc1b49aa4244f5d65ad3f5feb2a5
Port: 8080/TCP
Host Port: 0/TCP
State: Running
Started: Tue, 09 Apr 2019 07:18:43 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-6z8g2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-6z8g2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-6z8g2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 27m default-scheduler Successfully assigned default/kubernetes-bootcamp-5bf4d5689b-rq62d to minikube
Normal Pulled 27m kubelet, minikube Container image "jocatalin/kubernetes-bootcamp:v2" already present on machine
Normal Created 27m kubelet, minikube Created container
Normal Started 27m kubelet, minikube Started container

我们看到部署使用的是应用程序的稳定版本(V2)。回滚是成功的。

k8s 更新应用程序的更多相关文章

  1. c#自动更新+安装程序的制作 (转)

    c#自动更新+安装程序的制作 (转)  http://blog.csdn.net/myhuli120/article/details/6927588 一.自动更新的实现 让客户端实现自动更新,通常做法 ...

  2. c#自动更新+安装程序的制作

    一.自动更新的实现 让客户端实现自动更新,通常做法是在客户端部署一个单独的自动更新程序.主程序启动后,访问服务端,检查配置文件是否有更新版本,有更新版本就启动更新程序,由更新负责下载更新版本,并更新客 ...

  3. C#自动更新本地程序

    关于系统的自动更新.近日有一情况是需要将java端后台最新版本的系统文件覆盖本地客户端,简称自动更新了. 本地会获取当前系统的版本号去请求后台java的接口数据.返回给我的是后台压缩包转的base64 ...

  4. 【干货】WordPress系统级更新,程序升级

    [干货]WordPress系统级更新,程序升级 网站技术日新月异,更新升级是维护工作之一,长时间不升级的程序,就如长时间不维护的建筑物一样,会加速老化.功能逐渐缺失直至无法使用.在使用WordPres ...

  5. win10周年更新后程序各种卡死,进程无法结束怎么破?

    最近THINKPAD T460P更新了WIN10周年版后程序各种卡死,运行一段时间,各种程序就开始崩溃,进程无法结束,最终只能强制关机. 这个BUG微软已经确认了,安装了SSD+HDD双硬盘的WIN1 ...

  6. 怎样用VB自动更新应用程序

    具体程序实现如下:在应用程序工程MyApp中的部分代码如下:Option Explicit'编译后的应用程序名称,注意没有后缀 .EXE,本例为MYAPPPrivate Const App_Name ...

  7. Docker在Linux上运行NetCore系列(五)更新应用程序

    转发请注明此文章作者与路径,请尊重原著,违者必究. 本篇文章与其它系列文章不同,为了方便测试,新建了一个ASP.Net Core视图应用. 备注:下面说的应用,只是在容器中运行的应用程序. 查看现在运 ...

  8. cocos2d-js 在线更新代码脚本 动态更新脚本程序 热更新 绕过平台审核 不需重新上架

    2014年8月15日补充 cocos2d-js 3.0 rc0 的AssetsManager有缺陷,有一些注意点:(可以阅读源代码发现) 1.旧manifest中有,但新manifest中没有的文件( ...

  9. .net core i上 K8S(四).netcore程序的pod管理,重启策略与健康检查

    上一章我们已经通过yaml文件将.netcore程序跑起来了,但还有一下细节问题可以分享给大家. 1.pod管理 1.1创建pod kubectl create -f netcore-pod.yaml ...

随机推荐

  1. spring学习-1

    spring框架的组件结构图 IOC(Inversion of Control):反转控制,思想是反转资源获取方向,传统的资源查找方向是组件向容器发起请求资源查找,作为回应,容器适时的返回资源,IOC ...

  2. 关于 numpy.array和list之间的转换

    有两种方法: 1. 直接用list()函数 2. 用array.tolist()函数 如果np.array是一维,两者没有区别.但如果是二维结果是不同的. import numpy as np a1= ...

  3. resin启动时报错com.caucho.config.LineConfigException的解决

    resin启动时报以下错误: [13:32:10.120] {main} WEB-INF/web.xml:42: 'listener-class' is an unknown property of ...

  4. P1731 生日蛋糕

    题目背景 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层 生日蛋糕,每层都是一个圆柱体. 设从下往上数第i(1<=i<=M)层蛋糕是半径为Ri, 高度为Hi的圆柱 ...

  5. YARN指令

    如果是使用了Cloudera来安装到此路径下: /opt/cloudera/parcels/CDH-5.10.2-1.cdh5.10.2.p0.5/bin 执行: sudo ./yarn applic ...

  6. GrayCode for state machine

    How & Why use Gray Code A gray counter is a binary counter where only one bit changes at a time. ...

  7. POJ 2017 No Brainer(超级水题)

    一.Description Zombies love to eat brains. Yum. Input The first line contains a single integer n indi ...

  8. Express Route的配置

    ExpressRoute在中国已经Preview了. 本篇文章讲介绍ExpressRoute如何配置. Express Route的逻辑拓扑结构: 在配置Express Route之前,需要做VLAN ...

  9. Python:列表反序和解析

    1)列表反序 A.list.reverse():将列表反序: l = [1, 2, 3, 4, 5] print(l.reverse()) -->[5, 4, 3, 2, 1] B.l.[::- ...

  10. TS学习之枚举

    使用枚举可以定义一些有名字的数字常量 enum Test{ one = 1, two, three, four } console.log(Test); /*{ '1': 'one', '2': 't ...