繁体   English   中英

在Google Cloud Platform中更新Docker映像

[英]Updating a docker image in Google Cloud Platform

我以为我已经找到了如何在Google Container Engine中更新Docker映像的方法,但现在它只是还原为该映像的原始版本。 这是我所做的:

原始图片

docker build -t gcr.io/jupiter-1068/jupiter .
gcloud docker push gcr.io/jupiter-1068/jupiter
kubectl create -f rc.yaml

v2

docker build -t gcr.io/jupiter-1068/jupiter:2 .
gcloud docker push gcr.io/jupiter-1068/jupiter:2
kubectl rolling-update staging --image=gcr.io/jupiter-1068/jupiter:2

这工作了。 但是后来我尝试以与v2相同的方式更新到v3,它似乎正在运行原始图像代码。 这是怎么回事?

更新

:latest再次尝试。 kubectl describe rc staging输出kubectl describe rc staging

Name:       staging
Namespace:  default
Image(s):   gcr.io/jupiter-1068/jupiter:latest
Selector:   app=jupiter,deployment=f400f87308696febbe567614f3cc3428,version=1
Labels:     run=staging
Replicas:   1 current / 1 desired
Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
No events.

kubectl describe pod <podname>输出kubectl describe pod <podname>

Name:               staging-b4c7103521d97ef91f482db729da9584-0va8i
Namespace:          default
Image(s):           gcr.io/jupiter-1068/jupiter:latest
Node:               gke-staging-4adcf7c5-node-ygf7/10.240.251.174
Labels:             app=jupiter,deployment=f400f87308696febbe567614f3cc3428,version=1
Status:             Running
Reason:
Message:
IP:             10.8.0.24
Replication Controllers:    staging (1/1 replicas created)
Containers:
  jupiter:
    Image:  gcr.io/jupiter-1068/jupiter:latest
    Limits:
      cpu:      100m
    State:      Running
      Started:      Tue, 15 Sep 2015 21:08:32 -0500
    Ready:      True
    Restart Count:  1
Conditions:
  Type      Status
  Ready     True
Events:
  FirstSeen             LastSeen            Count   From                        SubobjectPath               Reason      Message
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {scheduler }                                        scheduled   Successfully assigned staging-b4c7103521d97ef91f482db729da9584-0va8i to gke-staging-4adcf7c5-node-ygf7
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    implicitly required container POD   pulled      Pod container image "gcr.io/google_containers/pause:0.8.0" already present on machine
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    implicitly required container POD   created     Created with docker id 13cd80e199a4
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    implicitly required container POD   started     Started with docker id 13cd80e199a4
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    spec.containers{jupiter}        created     Created with docker id 724fdedd11be
  Tue, 15 Sep 2015 21:07:05 -0500   Tue, 15 Sep 2015 21:07:05 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    spec.containers{jupiter}        started     Started with docker id 724fdedd11be
  Tue, 15 Sep 2015 21:08:32 -0500   Tue, 15 Sep 2015 21:08:32 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    spec.containers{jupiter}        created     Created with docker id 2022b9f5f054
  Tue, 15 Sep 2015 21:08:32 -0500   Tue, 15 Sep 2015 21:08:32 -0500 1   {kubelet gke-staging-4adcf7c5-node-ygf7}    spec.containers{jupiter}        started     Started with docker id 2022b9f5f054

docker中的:latest标签有点令人困惑。 这并不意味着最新上传,它是您未指定标签时设置的默认名称。

在您的情况下,:latest指向您的原始图像,因为这是您未指定标签的唯一上载。

要弄清楚发生了什么,请尝试运行kubectl describe rc staging ,它将向您显示复制控制器的详细信息,包括它认为正在运行的映像以及与之相关的任何事件。 如果输出显示rc正在运行新映像,则检查pod(使用kubectl describe pods <pod-name> )以查看它们正在运行哪个映像以及是否有任何事件。

希望这两个命令可以使您了解正在发生的事情,但是如果没有,请返回输出!

我手动删除并重新创建了rc / pod,现在一切正常,包括滚动更新。 来自支持:

看来Container Registry中存在一个问题,阻止了图像的v2被拉出,但是由于图像和吊舱被删除,我们将无法进一步调查。

如果您遇到此问题,请考虑与他们联系,以便他们可以调查此问题,然后再删除您的窗格。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM