2015-09-04 70 views
2

我試圖在GKE上部署一個幽靈博客,工作於persistent disks with WordPress tutorial。我有手動運行罰款GKE節點上的工作容器:Google Container Engine上的Kubernetes窗格不斷重新啓動,從未準備好

kubectl run ghost --image=us.gcr.io/my_project_id/my-ghost-blog --port=2368 

當我這麼做,我可以捲曲:

docker run -d --name my-ghost-blog -p 2368:2368 -d us.gcr.io/my_project_id/my-ghost-blog 

使用下面的方法從另一教程中,我也可以正確地創建一個吊艙在內部IP的博客在集羣之內,並從kubectl get pod以下的輸出:

Name:  ghosty-nqgt0 
Namespace:  default 
Image(s):  us.gcr.io/my_project_id/my-ghost-blog 
Node:  very-long-node-name/10.240.51.18 
Labels:  run=ghost 
Status:  Running 
Reason: 
Message: 
IP:  10.216.0.9 
Replication Controllers: ghost (1/1 replicas created) 
Containers: 
    ghosty: 
    Image: us.gcr.io/my_project_id/my-ghost-blog 
    Limits: 
     cpu: 100m 
    State: Running 
     Started: Fri, 04 Sep 2015 12:18:44 -0400 
    Ready: True 
    Restart Count: 0 
Conditions: 
    Type Status 
    Ready True 
Events: 
    ... 

的問題出現了,當我插件tead嘗試從yaml文件創建Pod,每個Wordpress教程。這裏的YAML:

metadata: 
    name: ghost 
    labels: 
    name: ghost 
spec: 
    containers: 
    - image: us.gcr.io/my_project_id/my-ghost-blog 
     name: ghost 
     env: 
     - name: NODE_ENV 
      value: production 
     - name: VIRTUAL_HOST 
      value: myghostblog.com 
     ports: 
     - containerPort: 2368 

當我運行kubectl create -f ghost.yaml,創建吊艙,但從來沒有準備好:

> kubectl get pod ghost 
NAME  READY  STATUS RESTARTS AGE 
ghost  0/1  Running 11   3m 

的艙不斷重新啓動,由kubectl describe pod ghost輸出證實:

Name:  ghost 
Namespace:  default 
Image(s):  us.gcr.io/my_project_id/my-ghost-blog 
Node:  very-long-node-name/10.240.51.18 
Labels:  name=ghost 
Status:  Running 
Reason: 
Message: 
IP:  10.216.0.12 
Replication Controllers: <none> 
Containers: 
    ghost: 
    Image: us.gcr.io/my_project_id/my-ghost-blog 
    Limits: 
     cpu: 100m 
    State: Running 
     Started: Fri, 04 Sep 2015 14:08:20 -0400 
    Ready: False 
    Restart Count: 10 
Conditions: 
    Type Status 
    Ready False 
Events: 
    FirstSeen  LastSeen  Count From    SubobjectPath  Reason Message 
    Fri, 04 Sep 2015 14:03:20 -0400 Fri, 04 Sep 2015 14:03:20 -0400 1 {scheduler }      scheduled Successfully assigned ghost to very-long-node-name 
    Fri, 04 Sep 2015 14:03:27 -0400 Fri, 04 Sep 2015 14:03:27 -0400 1 {kubelet very-long-node-name} implicitly required container POD created Created with docker id dbbc27b4d280 
    Fri, 04 Sep 2015 14:03:27 -0400 Fri, 04 Sep 2015 14:03:27 -0400 1 {kubelet very-long-node-name} implicitly required container POD started Started with docker id dbbc27b4d280 
    Fri, 04 Sep 2015 14:03:27 -0400 Fri, 04 Sep 2015 14:03:27 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  created Created with docker id ceb14ba72929 
    Fri, 04 Sep 2015 14:03:27 -0400 Fri, 04 Sep 2015 14:03:27 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  started Started with docker id ceb14ba72929 
    Fri, 04 Sep 2015 14:03:27 -0400 Fri, 04 Sep 2015 14:03:27 -0400 1 {kubelet very-long-node-name} implicitly required container POD pulled Pod container image "gcr.io/google_containers/pause:0.8.0" already present on machine 
    Fri, 04 Sep 2015 14:03:30 -0400 Fri, 04 Sep 2015 14:03:30 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  started Started with docker id 0b8957fe9b61 
    Fri, 04 Sep 2015 14:03:30 -0400 Fri, 04 Sep 2015 14:03:30 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  created Created with docker id 0b8957fe9b61 
    Fri, 04 Sep 2015 14:03:40 -0400 Fri, 04 Sep 2015 14:03:40 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  created Created with docker id edaf0df38c01 
    Fri, 04 Sep 2015 14:03:40 -0400 Fri, 04 Sep 2015 14:03:40 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  started Started with docker id edaf0df38c01 
    Fri, 04 Sep 2015 14:03:50 -0400 Fri, 04 Sep 2015 14:03:50 -0400 1 {kubelet very-long-node-name} spec.containers{ghost}  started Started with docker id d33f5e5a9637 
... 

如果我不殺死吊艙,創建/啓動的這個循環會永遠持續下去。與成功的pod唯一的區別是缺少複製控制器。我不指望這是問題,因爲本教程沒有提及rc。

這是怎麼發生的?我怎樣才能從配置文件創建一個成功的pod?我在哪裏可以找到關於發生什麼的更詳細的日誌?

回答

2

如果相同的碼頭圖像通過kubectl run工作,但不能在吊艙中工作,然後是w rong與pod規格。比較從spec創建的和由rc創建的pod的完整輸出,通過運行kubectl get pods <name> -o yaml來查看兩者的不同之處。在黑暗中拍攝:pod規範中指定的環境變量是否有可能導致其在啓動時崩潰?

相關問題