Deploy and Expose Applications with Kubernetes on Docker for Windows

After deploying and playing with Kubernetes on my Docker for Windows machine I decided that it is time to learn how to expose a basic application to the real world and make it accessible.

By default, any deployed application to Kubernetes will not be exposed or be available to unless exposing it from the Kubernetes cluster as a Service.

In Kubernetes, exposed applications are available to be viewed from the Web UI under the Services section.

Get Started

Below, you will show how I create an application running a sample image from Google’s container register with port 8080 open.

kubectl run hello-world --replicas=1 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080

Once deployed, the application is still not exposed but I can see it in the Web UI

Expose

I will use the command below to expose the application by creating a service named hello-world

kubectl expose deployment hello-world --type=LoadBalancer --name=hello-world

After running the expose command my container is now exposed on port 8080 and if I go the services and click on the link under external endpoints I will be able to view my application

And the end result is that my application is accessible

About Kubernetes

Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications that was originally designed by Google and donated to the Cloud Native Computing Foundation.

This blog post was first published on DeployContainers.com

 


Posted

in

by