minikube 之 kubectl create 一直处于 ContainerCreating 状态

本贴最后更新于 2085 天前,其中的信息可能已经时移俗易

文件 pod_nginx.yml

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80

创建 kubectl create

kubectl create -f pod_nginx.yml

使用命令查看 pods 状态,很久还是没有启动成功

zousiliangdeMacBook-Pro:pod-basic zousiliang$ kubectl get pods -o wide
NAME      READY          STATUS      RESTARTS   AGE       IP           NODE
nginx     1/1       ContainerCreating   0          30m       172.17.0.2   minikube

查看详情

zousiliangdeMacBook-Pro:pod-basic zousiliang$ kubectl describe pod nginx
Name:         nginx
Namespace:    default
Node:         minikube/192.168.99.100
Start Time:   Mon, 08 Apr 2019 00:24:03 +0800
Labels:       app=nginx
Annotations:  <none>
Status:       Pending
IP:
Containers:
  nginx:
    Container ID:
    Image:          nginx
    Image ID:
    Port:           80/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5bz7m (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          False
  PodScheduled   True
Volumes:
  default-token-5bz7m:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-5bz7m
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     <none>
Events:
  Type     Reason                  Age   From               Message
  ----     ------                  ----  ----               -------
  Normal   Scheduled               14s   default-scheduler  Successfully assigned nginx to minikube
  Normal   SuccessfulMountVolume   14s   kubelet, minikube  MountVolume.SetUp succeeded for volume "default-token-5bz7m"
  Warning  FailedCreatePodSandBox  0s    kubelet, minikube  Failed create pod sandbox.

错误提示为:

Warning FailedCreatePodSandBox 0s kubelet, minikube Failed create pod sandbox.

获知为使用地址 gcr.io/google_containers/pause-amd64:3.0 进行拉取镜像,但是这个地址被墙了

$ docker pull docker.io/kubernetes/pause

$ docker tag kubernetes/pause:latest gcr.io/google_containers/pause-amd64:3.0

最后把原来的 pod 删除掉,再重新启动即可。

zousiliangdeMacBook-Pro:pod-basic zousiliang$ kubectl delete -f pod_nginx.yml
pod "nginx" deleted

zousiliangdeMacBook-Pro:pod-basic zousiliang$ kubectl create -f pod_nginx.yml
pod "nginx" created

zousiliangdeMacBook-Pro:pod-basic zousiliang$ kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
nginx     1/1       Running   0          14m
  • Docker

    Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的操作系统上。容器完全使用沙箱机制,几乎没有性能开销,可以很容易地在机器和数据中心中运行。

    492 引用 • 926 回帖
  • kubectl
    1 引用
  • minikube
    1 引用

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...