鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ k8s 創(chuàng)建容器一直 container creating

k8s 創(chuàng)建容器一直 container creating

  1. K8S 創(chuàng)建容器后,查看pod狀態(tài),一直是 ContainerCreating
  2. 創(chuàng)建容器命令
kubectl run nginx --image=10.0.2.22:5080/general/ubuntu-nginx:16 --command -- nginx
  1. 下面是 kubectl describe 信息
[root@localhost ~]# kubectl describe pods nginx
Name:           nginx-878073783-8hd2p
Namespace:      default
Node:           node82/10.0.2.82
Start Time:     Thu, 14 Sep 2017 19:35:40 +0800
Labels:         pod-template-hash=878073783
                run=nginx
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"nginx-878073783","uid":"d61d2d0b-9940-11e7-83bc-001a4a16016d","a...
Status:         Pending
IP:
Created By:     ReplicaSet/nginx-878073783
Controlled By:  ReplicaSet/nginx-878073783
Containers:
  nginx:
    Container ID:
    Image:              10.0.2.22:5080/general/ubuntu-nginx:16
    Image ID:
    Port:               <none>
    Command:
      nginx
    State:              Waiting
      Reason:           ContainerCreating
    Ready:              False
    Restart Count:      0
    Environment:        <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-hkp5r (ro)
Conditions:
  Type          Status
  Initialized   True
  Ready         False
  PodScheduled  True
Volumes:
  default-token-hkp5r:
    Type:       Secret (a volume populated by a Secret)
    SecretName: default-token-hkp5r
    Optional:   false
QoS Class:      BestEffort
Node-Selectors: <none>
Tolerations:    node.alpha.kubernetes.io/notReady:NoExecute for 300s
                node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                    -------------   --------        ------                  -------
  1m            1m              1       default-scheduler                       Normal          Scheduled               Successfully assigned nginx-878073783-8hd2p to node82
  1m            1m              1       kubelet, node82                         Normal          SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-hkp5r"
  1m            1s              75      kubelet, node82                         Normal          SandboxChanged          Pod sandbox changed, it will be killed and re-created.
  1m            0s              76      kubelet, node82                         Warning         FailedSync              Error syncing pod
  1. 截圖
    圖片描述
回答
編輯回答
悶油瓶

Error syncing 可能是容器本身的問題??梢杂?kubectl logs nginx-xxx來看一下

2017年12月13日 17:30
編輯回答
冷溫柔

可能是k8s的api服務(wù)沒裝好。

2017年1月23日 20:51
編輯回答
心夠野

我也遇到這個(gè)問題。

應(yīng)該去看對(duì)應(yīng) pod 所在節(jié)點(diǎn)的 kubelet 的日志,就能看到錯(cuò)誤原因了。

2018年1月2日 22:55