<p>I have installed Kubernetes and Docker. Windows10.
Then ran nginx in docker.
Works great.
Then changed the index.html to have my name in it and made my own image called rk_nginx_base.  Works fine.
Then changed the port for nginx from 80 to 9090.</p>
<p>If I run it in docker (The desktop UI), it works fine...
I see the page in the browser at http://localhost:9090 and get the little icon to launch the browser in the docker UI.
I can refresh the page all I want and it shows the page just fine.</p>
<p>Then I have a kubernetes yaml file ...</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
    app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: rk_nginx_base
        ports:
        - containerPort: 9090
</code></pre>
<p>Then I do</p>
<pre><code>kubectl apply -f .\nginx-deployment.yaml
</code></pre>
<p>and I see it come up in docker UI.
The first time I hit the server it works. (Probably cache in the browser after running in Docker)
but any subsequent refreshes on any browser (Brave, Chrome, Edge) fails and get the error message</p>
<pre><code>This site can’t be reached 
localhost refused to connect.
</code></pre>
<p>I have tried various solution including adding in a hostPort: 9090 below the containerPort, add a Service for NodePort, and tried kubectl expose -f .\nginx-deployment.yaml</p>
<p>Any ideas?</p>

Richard Keene
<p>Turns out it was the command</p>
<pre><code>kubectl expose mynginx
</code></pre>
<p>was needed to make the internal IP's get forwarded to the localhost IP.</p>
