参考: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)。回滚是成功的。
所有评论(0)