linuxwindowsamazon-web-serviceskubernetesgcloud

Windows & Linux living together in Kubernetes cluster


I was looking at the kubernetes documentation which seems to have a windows compability, however I don't find completely clear if both Linux and Windows can live together (I mean, in diferent VMs but the same cluster).

I would like to know if there is any support for this scenario in gcloud, azure or aws. And also, the procedure or example to make it work. Like how to create a pod in the correct VM (windows or linux) and how horizontal and cluster autoscalers work.

The use case is 2 APIs, one running in windows (.NET Framework) and other in linux (python/c++) and I want to be able to reroute them, be able to call each other, scale them and so on with kubernetes. As a note, the .NET Framework application have dependencies (mainly for mathematical optimization) that cannot be passed to .NET Core, this implies that I cannot convert the application to linux-based.


Solution

  • Some history, so containers is a Linux thing so there are no containers per se on Windows. Docker created Docker for Windows but essentially what it does is run a Hyper-V Linux VM (used to be VirtualBox) and inside it runs your containers. As of the latest Docker version, Microsoft has added capabilities on Hyper-V to allow running these containers kinda natively making it easy to run .NET apps in containers.

    K8s is implemented in Golang so it was generally easier to port main components like the kubelet, kube-proxy, kubectl to Windows, by using the Golang cross-compiler (or native on Windows)

    A tricky part is the networking but looks like they've got it figured out in the docs

    As far as public cloud support from major providers:

    Other than that I don't know what else there's to it (Other than what's in the docs) The question is very broad. Just install Docker for Windows, setup networking, join your cluster with kubeadm and schedule your Windows workloads using the nodeSelector spec in your pods and make sure you label your Windows nodes with beta.kubernetes.io/os=windows

    There's another good guide on to set up Kubernetes with Windows nodes here