<p>I am new on kubernetes and I tried to run small app using kubernetes. I created docker image and used minikube to run it. So application is very simple, it just prints hello-world.</p>
<pre><code>@RestController
@RequestMapping(value = &quot;helloworld&quot;)
public class MyController {

    @GetMapping
    public HelloWord helloWord(){

        return new HelloWord(&quot;Hello Word&quot;);
    }
}
</code></pre>
<p>My dockerfile:</p>
<pre><code>FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
VOLUME /tmp
ARG JAR_FILE=target/myapp-1.0.0.jar
COPY ${JAR_FILE} myapp-1.0.0.jar
ENTRYPOINT [&quot;java&quot;,&quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;/myapp-1.0.0.jar&quot;]
</code></pre>
<p>deployment.yaml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: myhelloworldservice
spec:
  selector:
    app: my-hello-world-app
  ports:
    - protocol: &quot;TCP&quot;
      port: 8080
      targetPort: 80
      nodePort: 30003
  type: LoadBalancer


---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-hello-world
spec:
  selector:
    matchLabels:
      app: my-hello-world-app
  replicas: 5
  template:
    metadata:
      labels:
        app: my-hello-world-app
    spec:
      containers:
        - name: hello-world
          image: myname/myhelloimage
          ports:
            - containerPort: 80
</code></pre>
<p>I run the command :</p>
<blockquote>
<p>kubectl create -f deployment.yaml</p>
</blockquote>
<p>and the output is :</p>
<blockquote>
<p>service/myhelloworldservice created</p>
<p>created deployment.apps/my-hello-world</p>
</blockquote>
<p>I run minikube ip command to get ip and then used that ip adress to access my app by using port 30003, but not able to access my app.</p>
<p>I used :</p>
<p><a href="http://xxx.xx.xx.xxx:30003/helloworld" rel="nofollow noreferrer">http://xxx.xx.xx.xxx:30003/helloworld</a></p>
<p>What is the problem why I cannot access to my app? I am getting This site can’t be reached. Refused to connect error.</p>

user1474111
<p>You can port forward from your minikube to your localhost using <code>kubectl port-forward &lt;&lt;created_container_name&gt;&gt; 80</code>
Now you should be able to access your app through a browser with <code>localhost:80/helloworld</code></p>
