'Windows Containers on windows and linux Kubernetes cluster

I'm kind of new to the Kubernetes world. In my project we are planning to use windows containers(.net full framework) in short term and linux containers(.net core) for the long run.

We have a K8 cluster provided by infrastructure team and the cluster has mix of Linux and Windows nodes. I just wanted to know how my windows containers will only be deployed to windows nodes in the K8 cluster. Is it handled by K8 or Do I need anything else ?



Solution 1:[1]

Below are the details from the Kubernetes Windows Documentation.

Because your cluster has both Linux and Windows nodes, you must explicitly set the nodeSelector constraint to be able to schedule pods to Windows nodes. You must set nodeSelector with the label beta.kubernetes.io/os to the value windows; see the following example:

apiVersion: v1
kind: Pod
metadata:
  name: iis
labels:
  name: iis
spec:
  containers:
    - name: iis
      image: microsoft/iis:windowsservercore-1709
      ports:
        - containerPort: 80
  nodeSelector:
    "kubernetes.io/os": windows

Solution 2:[2]

You would need to add following lines to your YAML file. Details are available here https://kubernetes.io/docs/getting-started-guides/windows/

nodeSelector: "beta.kubernetes.io/os": windows

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Gregory Suvalian