<p>I have been following this tutorial on creating a hello-world app</p>
<p><a href="https://medium.com/@bhargavshah2011/hello-world-on-kubernetes-cluster-6bec6f4b1bfd" rel="nofollow noreferrer">https://medium.com/@bhargavshah2011/hello-world-on-kubernetes-cluster-6bec6f4b1bfd</a></p>
<p>First I create a cluster on gcloud (called hello-world2)</p>
<p><a href="https://i.stack.imgur.com/Gfa4B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gfa4B.png" alt="enter image description here" /></a></p>
<p>then connect to it locally :</p>
<p><a href="https://i.stack.imgur.com/UUp9y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UUp9y.png" alt="enter image description here" /></a></p>
<p>Next I do a <strong>git clone</strong> of the project listed in the article.</p>
<pre><code>git clone https://github.com/skynet86/hello-world-k8s.git
cd hello-world-k8s/
</code></pre>
<p>Inside the directory I find this <strong>hello-world.yaml</strong> .</p>
<p>It basically lists a deployment and service (I have renamed everything from hello-world to hello-world2)</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world2-deployment
  labels:
    app: hello-world2
spec:
  selector:
    matchLabels:
      app: hello-world2
  replicas: 2
  template:
    metadata:
      labels:
        app: hello-world2
    spec:
      containers:
      - name: hello-world2
        image: bhargavshah86/kube-test:v0.1
        ports:
        - containerPort: 80
        resources:
          limits:
            memory: 256Mi
            cpu: &quot;250m&quot;
          requests:
            memory: 128Mi
            cpu: &quot;80m&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: hello-world2
spec:
  selector:
    app: hello-world2
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 30081   
  type: NodePort
</code></pre>
<p>I apply this file by running :</p>
<pre><code>kubectl create -f hello-world.yaml
</code></pre>
<p>Next I run <strong>kubectl get all</strong> and all my services are nicely listed.</p>
<p><a href="https://i.stack.imgur.com/fgi2s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fgi2s.png" alt="enter image description here" /></a></p>
<p>Now, the article claims, I can see my new application by going to this URL : <strong>http://localhost:30081</strong>.</p>
<p>But I get nothing when I navigate to this link :</p>
<p><a href="https://i.stack.imgur.com/IrEnT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IrEnT.png" alt="enter image description here" /></a></p>
<p>What am I doing wrong here?</p>
<p>Also, another question (sorry..). How do I connect this service/deployment to my cluster? is there some kind of <strong>cluster apply service</strong> command which i need to do? Is my service implicitly already connected?</p>

Oliver Watkins
<ol>
<li><p>You need to port-forward the service to your localhost. They most handy way to do this is using <a href="https://github.com/txn2/kubefwd" rel="nofollow noreferrer">https://github.com/txn2/kubefwd</a>. This will batch forward all services in a namespace and even will make the DNS names work locally. Very useful when you debugging 1 service from the IDE locally and everything else stays in the cloud.</p>
</li>
<li><p>Cluster DNS. Every <code>Service</code> objects gets a DNS record inside the cluster DNS server automatically: <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#services" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#services</a>. From inside the cluster (other pods), you call your service using <code>service_name.service_namespace.svc.cluster.local:service_port</code> notation.</p>
</li>
</ol>
