k8s 创建容器一直 container creating

  1. K8S 创建容器后,查看pod状态,一直是 ContainerCreating
  2. 创建容器命令
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. 截图
    图片描述
阅读 13.3k
3 个回答

可能是k8s的api服务没装好。

Error syncing 可能是容器本身的问题。可以用 kubectl logs nginx-xxx来看一下

我也遇到这个问题。

应该去看对应 pod 所在节点的 kubelet 的日志,就能看到错误原因了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题