用户反映: 创建资源的时候无法从本地pull image造成创建deployment失败。

检查思路:根据用户提供的创建失败deployment信息,

通过kubectl describe deployment/xxx -n yyy

可以看到错误提示没有使用本地的image,远程拉取image,但是提示需要docker login。

通过docker images可以看到node1节点(非master)本地确实也是有这个image,

尝试创建pod指定在node1上创建也是失败。

然后看了用户的deployment的ymal文件,增加了下面的行,问题解决.

    spec:
      containers:
      - name: xxxx
        image: xxxx
        imagePullPolicy: IfNotPresent   #增加行,表示如果本地没有,才从远程仓库拉取
        ports:
          - containerPort: 80

gImages | KubernetesA container image represents binary data that encapsulates an application and all its software dependencies. Container images are executable software bundles that can run standalone and that make very well defined assumptions about their runtime environment.You typically create a container image of your application and push it to a registry before referring to it in a PodThis page provides an outline of the container image concept.Image names Container images are usually given a name such as pause, example/mycontainer, or kube-apiserver.https://kubernetes.io/docs/concepts/containers/images/#updating-images

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐