<p>I am using two virtual machines, installed with centos 7. Host is win10 professional version. </p>

<p>I followed the <a href="https://github.com/trisberg/devoxx-spring-boot-k8s/blob/master/demo-hello.adoc" rel="nofollow noreferrer">link</a> to make spring boot application container managed by kubernetes. The link is using minikube, but I am using two nodes as kubernetes minimum installation. One node is master(172.16.100.81), one node is worker (172.16.100.96). With hello application, I follow the step, it works. The brief of my command is as follows:</p>

<pre><code>docker build -t $USER/hello:0.0.1 .
kubectl run hello --image $USER/hello:0.0.1 --port 8080
kubectl expose deployment hello --type=NodePort
</code></pre>

<p>so far everything is nice. I could even make it scale to replica=3. </p>

<p>But now I modify the spring boot application, I just add a couple of characters as follows:</p>

<pre><code>package com.springdeveloper.k8s.hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
public class HelloApplication {

        public static void main(String[] args) {
                SpringApplication.run(HelloApplication.class, args);
        }

        @RestController
        class HelloController {
                @GetMapping("/hello")
                String hello() {
                        return "Hello Kubernauts!, are there image transfer?";
                }
        }


}
</code></pre>

<p>With this change, I also changed Dockerfile so that it may not have conflicts with previous version. The modified Dockerfile is as follows:</p>

<pre><code>FROM registry.docker-cn.com/library/openjdk:8-alpine
VOLUME /tmp
ADD ./target/hello-0.0.1-SNAPSHOT.jar /hello2.jar
RUN sh -c 'touch /hello2.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","q/hello2.jar"]
</code></pre>

<p>original Dockerfile is as follows:</p>

<pre><code>FROM registry.docker-cn.com/library/openjdk:8-alpine
VOLUME /tmp
ADD ./target/hello-0.0.1-SNAPSHOT.jar /hello.jar
RUN sh -c 'touch /hello.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/hello.jar"]
</code></pre>

<p>Then I do the same steps as previously did:</p>

<pre><code>docker build -t $USER/hello2:0.0.2 .
kubectl run hello2 --image $USER/hello2:0.0.2 --port 8081
kubectl expose deployment hello2 --type=NodePort
</code></pre>

<p>But hello2 could not be in ready state, while hello is in ready state. I could not see the difference between hello and hello2. Why hello2 could not be in ready state?</p>

<pre><code>[root@master2 hello]# kubectl get pods
NAME                     READY     STATUS             RESTARTS   AGE
hello-7db856d974-sg9kh   1/1       Running            0          1h
hello2-5c9c6776d-zgvhs   0/1       ImagePullBackOff   0          51m
</code></pre>

<p>I then use kubectl logs: it shows:</p>

user84592
<ol>
<li><p>You are adding the jar to <code>/hello2.jar</code> but the <code>ENTRYPOINT</code> points to <code>q/hello2.jar</code>.</p></li>
<li><p>Your port is now <code>8081</code>, but Springs default is <code>8080</code> which you correctly used in the first attempt. </p></li>
</ol>

<p>Did you try to start the container locally and have a look into the logs?</p>
