Kubernetes on docker for Windows and few crocodiles…

I am a linux guy, but one of my work boxes is Intel NUC under windows with quite good memory specs. So far I was using it to offload docker builds and use some VMs on a hyperV. Latest docker update has made things even more interesting — Docker for windows now is capable to run single node Kubernetes 1.1x cluster, which you can use for your experiments as well.

Even if Windows has WSL, it still does not behave in a way how my usual linux workplace do, thus on my local lab first (note: insecure) step I do — is exposing my windows kubernetes and docker ports to my linux notebook

Expose docker tcp daemon on 2375

Expose kubernetes management port

Accessing your cluster with kubectl from your linux machine:

What you need — is to replicate config on your linux box, and tune server address to external interface address of your box.

After that, you can see the context on your linux box

and control it using native kubectl tool

Lets test install kubernetes dashboard, because docker for windows provides no specific UI for that part

New release of dashboard comes with RBAC as a default, but for that specific case we can go on a simplier setup, and get admin rights from the start : kubectl create -f k8s/dashboard-admin.yaml where dashboard-admin.yaml is

Now you can run kubectl proxy in some console, and also some better control over kubernetes cluster, accessible on http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default

Prof of concept deployment

kubectl create -f croc-hunter.yaml --save-config

and ingress to it

Now we can check, if application was deployed correctly:

Definitely works. We can also access the application via kube proxy http://localhost:8001/api/v1/namespaces/default/services/http:croc-hunter:/proxy/

Exposing deployment externally

We might to it dirty the console, like

note tcp port 30815 above.

How can you access exposed ports?

Option (a), on the same windows box you can just navigate to http://127.0.0.1:30815/

We can achieve the same effect from the yaml definition

note tcp port as well 30688.

Option(b) — basically I am also able to access port exposed on a box from my external linux box as well:

Which is kind of cool.

Summary: you can use built-in single node kubernetes node for small playground with your kubernetes experiments not only locally, but also on remote using set of tools you. This might be alternative to minikube / minishift if you do not need specific functionality from those.

Thanks!

Code in action:

Croco game image: https://github.com/voronenko-p/docker-sample-image which is slightly modified https://github.com/lachie83/croc-hunter (fixed absolute references to resources to allow proper run under proxy)

Using for the first time

for subsequent…

Debugging access — requires running kubectl proxy in background...

Launch kubernetes dashboard from url http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default if you have installed one

Launch deployed micro service http://localhost:8001/api/v1/namespaces/default/services/http:croc-hunter:/proxy/

Software engineer, with project management background. Founder @ softasap.com — cool automation for the people :) — have a problem that needs to be solved?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store