Now that we have our cluster running and the Node ready for our “Hello World” application, lets deploy it. We need to provide a deployment name as well as the app image to be used:
kubectl create deployment hello-world --image=vtrhh/hello-world-app
⚠️ If you are a linux user, please use the following command (and another image) instead:
kubectl create deployment hello-world --image=vtrhh/hello-world-app:amd64
Awesome - we just deployed our first app! Kubernetes took care of some tasks for us in the background:
To see details about your deployment, run
kubectl get deployments -o wide
We can see that there is 1 deployment running a single container of our app using the image we provided.
When checking for
kubectl get pods -o wide
we can confirm that there is one Pod running our application on the Node “docker-desktop”.
Also in the Docker Desktop application we can see changes. Open the app and select Containers in the sidebar. But as you can see - there are two containers running. One container is our app itself, but there is also another one, prefixed with POD. This container is created automatically by Docker Desktop and the image registry.k8s.io/pause and is providing the network for our application’s pod.
When clicking on our application container, we will see the following logs:
Lets see what happens in the browser when visiting http://localhost:3000.
Can you imagine why we are not seeing anything?
Reason is pretty simple: Pods in Kubernetes are running on a private, isolated network by default. They are visible for other Pods and Services within the same cluster - but not from the outside.
We hence need to expose our app as described in the next chapter.