<p>Most software tech has a &quot;Hello World&quot; type example to get started on. With Kubernetes this seems to be lacking.</p>
<p>My scenario cannot be simpler. I have a simple hello world app made with Spring-Boot with one Rest controller that just returns: &quot;Hello Hello!&quot;</p>
<p>After I create my docker file, I build an image like this :</p>
<pre><code>docker build -t helloworld:1.0 .
</code></pre>
<p>Then I run it in a container like this :</p>
<pre><code>docker run -p 8080:8080 helloworld:1.0
</code></pre>
<p>If I open up a browser now, I can access my application here :</p>
<pre><code>http://localhost:8080/hello/
</code></pre>
<p>and it returns :</p>
<pre><code>&quot;Hello Hello!&quot;
</code></pre>
<p><em>Great! So far so good.</em></p>
<p>Next I tag it (my docker-hub is called ollyw123, and the ID of my image is 776...)</p>
<pre><code>docker tag 7769f3792278 ollyw123/helloworld:firsttry
</code></pre>
<p>and push :</p>
<pre><code>docker push ollyw123/helloworld
</code></pre>
<p>If I log into Docker-Hub I will see</p>
<p><a href="https://i.stack.imgur.com/c1CCO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c1CCO.png" alt="enter image description here" /></a></p>
<p>Now I want to connect this to Kubernetes. This is where I have plunged deep into the a state of confusion.</p>
<p>My thinking is, I need to create a <strong>cluster</strong>. Somehow I need to connect this cluster to my <strong>image</strong>, and as I understand, I just need to use the URL of the image to connect to (ie.
<a href="https://hub.docker.com/repository/docker/ollyw123/helloworld" rel="nofollow noreferrer">https://hub.docker.com/repository/docker/ollyw123/helloworld</a>)</p>
<p>Next I would have to create a <strong>service</strong>. This service would then be able to expose my &quot;Hello World!&quot; rest call through some port. This is my logical thinking, and for me this would seem like a very simple thing to do, but the tutorials and documentation on Kubernetes is a mine field of confusion and dead ends.</p>
<p>Following on from the spring-boot kubernetes tutorial (<a href="https://spring.io/guides/gs/spring-boot-kubernetes/" rel="nofollow noreferrer">https://spring.io/guides/gs/spring-boot-kubernetes/</a>) I have to create a deployment object, and then a service object, and then I have to &quot;apply&quot; it :</p>
<pre><code>kubectl create deployment hello-world-dep --image=ollyw123/helloworld --dry-run -o=yaml &gt; deployment.yaml

kubectl create service clusterip hello-world-dep --tcp=8080:8080 --dry-run -o=yaml &gt;&gt; deployment.yaml

kubectl apply -f deployment.yaml
</code></pre>
<p>OK. Now I see a service :</p>
<p><a href="https://i.stack.imgur.com/8O9TY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8O9TY.png" alt="enter image description here" /></a></p>
<p>But now what???</p>
<p>How do I push this to the cloud? (eg. gcloud) Do I need to create a cluster first, or is this already a cluster?</p>
<p>What should my next step be?</p>

Oliver Watkins
<p>In the context of Kubernetes, <code>Cluster</code> is the environment where your <code>PODS</code> and <code>Services</code> are running. Think of it like a VM environment where you setup your Web Server and etc.. (although I don't like my own analogy)</p>
<p>If you want to run the same thing in GCloud, then you create a Kubernetes cluster there and all you need to do is to apply your <code>YAML</code> files that contains the <code>Service</code> and <code>Deployment</code> there via the CLI that Google Cloud provides to interact with your Cluster.</p>
<p>In order to interact with GCloud GKS Cluster via your local command prompt, you need to get the credentials for that cluster. <a href="https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials" rel="nofollow noreferrer">This</a> official GCloud document explain how to retrieve your cluster credential. once done, you can start interacting with the Kubernetes instance running in GCloud via <code>kubectl</code> command using your command prompt.</p>
