Imen
Imen

Reputation: 171

Kubernetes pod - image never pulled error

I'm trying to deploy my Lagom accessservices on Kubernetes.

To do that I tried to containerize my service using fabric8’s docker-maven-plugin.

So, I added the following plugin settings to the root project pom.xml to register the fabric8 Maven plugin:

<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>

And then, I Added the following plugin settings on the pom.xml under the application’s module directory:

<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>

After that, I build my project using:

eval $(minikube docker-env) 
clean package docker:build

And I think that it was succeeded because when I executed "docker images", I had:

enter image description here

But my problem is when I tried to deploy my services, I got this error:

Container image is not present with pull policy of NeverError syncing pod enter image description here

Do you have any explication for that? please.

*** Edit 1 ****

kubectl describe po accessservice-0 enter image description here

Upvotes: 3

Views: 6547

Answers (1)

Jose Armesto
Jose Armesto

Reputation: 13759

You need to use other imagePullPolicy different than Never, otherwise kubernetes will never try to download the image for your container. You can choose between Always or IfNotPresent, which will download the image only if it's not already downloaded. For example

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

Upvotes: 4

Related Questions