<p>I'm following a course on PluralSight where the course author puts a docker image onto kubernetes and then access it via his browser. I'm trying to replicate what he does but I cannot manage to reach the website. I believe I might be connecting to the wrong IP.</p>

<p>I have a <code>ReplicationController</code> that's running 10 <code>pods</code>:</p>

<p><strong>rc.yml</strong></p>

<pre><code>apiVersion: v1
kind: ReplicationController
metadata:
          name: hello-rc
spec:
        replicas: 10
        selector:
                app: hello-world
        template:
             metadata:
                labels:
                        app: hello-world
             spec:
                     containers:
                             - name: hello-pod
                               image: nigelpoulton/pluralsight-docker-ci:latest
                               ports:
                                       - containerPort: 8080
</code></pre>

<p>I then  tried to expose the rc:</p>

<pre><code>kubectl expose rc hello-rc --name=hello-svc --target-port=8080 --type=NodePort


$ kubectl get services
NAME         CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
hello-svc    10.27.254.160   &lt;nodes&gt;       8080:30488/TCP   30s
kubernetes   10.27.240.1     &lt;none&gt;        443/TCP          1h
</code></pre>

<p>My google container endpoint is : <code>35.xxx.xx.xxx</code> and when running <code>kubectl describe svc hello-svc</code> the NodePort is <code>30488</code></p>

<p>Thus I try to access the app at <code>35.xxx.xx.xxx:30488</code> but the site can’t be reached.</p>

<p>If you want to access your service via the NodePort port, you need to open your firewall for that port (and that instance).</p>

<p>A better way is to create a service of type LoadBalancer (<code>--type=LoadBalancer</code>) and access it on the IP Google will give you.</p>

<p>Do not forget to delete the load balancer when you are done.</p>
