Kubernetes pod - 图像从不拉错误

时间:2018-01-18 10:04:44

标签: maven kubernetes fabric8 lagom

我正在尝试在Kubernetes上部署我的Lagom访问服务。

要做到这一点,我尝试使用fabric8的docker-maven-plugin对我的服务进行容器化。

因此,我将以下插件设置添加到根项目pom.xml中以注册fabric8 Maven插件:

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.20.1</version>
    <configuration>
        <skip>true</skip>
        <images>
            <image>
                <name>%g/%a:%l</name>
                <build>
                    <from>openjdk:8-jre-alpine</from>
                    <tags>
                        <tag>latest</tag>
                        <tag>${project.version}</tag>
                    </tags>
                    <assembly>
                        <descriptorRef>artifact-with-dependencies</descriptorRef>
                    </assembly>
                </build>
            </image>
        </images>
    </configuration>
 </plugin>

然后,我在应用程序模块目录下的pom.xml中添加了以下插件设置:

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <configuration>
        <skip>false</skip>
        <images>
            <image>
                <build>
                    <entryPoint>
                        java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -cp '/maven/*' -Dhttp.address="$(eval "echo $ACCESSSERVICE_BIND_IP")" -Dhttp.port="$(eval "echo $ACCESSSERVICE_BIND_PORT")" -Dakka.remote.netty.tcp.hostname="$(eval "echo $AKKA_REMOTING_HOST")" -Dakka.remote.netty.tcp.bind-hostname="$(eval "echo $AKKA_REMOTING_BIND_HOST")" -Dakka.remote.netty.tcp.port="$(eval "echo $AKKA_REMOTING_PORT")" -Dakka.remote.netty.tcp.bind-port="$(eval "echo $AKKA_REMOTING_BIND_PORT")" $(IFS=','; I=0; for NODE in $AKKA_SEED_NODES; do echo "-Dakka.cluster.seed-nodes.$I=akka.tcp://accessservice@$NODE"; I=$(expr $I + 1); done) play.core.server.ProdServerStart
                    </entryPoint>
                </build>
            </image>
        </images>
    </configuration>
</plugin>

之后,我使用:

构建我的项目
eval $(minikube docker-env) 
clean package docker:build

我认为它成功了,因为当我执行“docker images”时,我有:

enter image description here

但我的问题是当我尝试部署我的服务时,我收到了这个错误:

  

NeverError同步的pull策略不存在容器图像   荚   enter image description here

你有解释吗?请。

***编辑1 ****

  

kubectl描述了po accessservice-0   enter image description here

1 个答案:

答案 0 :(得分:1)

您需要使用与imagePullPolicy不同的其他Never,否则kubernetes将永远不会尝试为您的容器下载图片。在Always或IfNotPresent之间You can choose,只有在尚未下载图像时才下载图像。例如

apiVersion: v1
kind: Pod
metadata:
  name: my-app
spec:
  containers:
    - name: my-app
      image: my-app-image
      imagePullPolicy: Always