<p>I have a little <code>windows .exe</code> deployed in azure kubernetes cluster. When I run <code>kubectl get pods</code>I get the following result,</p>
<pre><code>NAME                                    READY   STATUS             RESTARTS   AGE
sample-deploy-548d6b9c6b-8v2nb          0/1     CrashLoopBackOff   5          6m12s
sample-deploy-548d6b9c6b-fpmz9          0/1     CrashLoopBackOff   5          6m12s
sample-deploy-548d6b9c6b-hgsj7          0/1     CrashLoopBackOff   5          6m12s
</code></pre>
<p>When I run <code>kubectl describe pod sample-deploy-548d6b9c6b-8v2nb</code> I get the following details</p>
<pre><code>Name:           sample-deploy-548d6b9c6b-8v2nb
Namespace:      default
Priority:       0
Node:           akswin000000/10.240.0.35
Start Time:     Thu, 02 Jul 2020 16:59:02 +0100
Labels:         app=sampleservice
                pod-template-hash=548d6b9c6b
Annotations:    &lt;none&gt;
Status:         Running
IP:             10.240.0.45
IPs:            &lt;none&gt;
Controlled By:  ReplicaSet/sample-deploy-548d6b9c6b
Containers:
  sampleservice:
    Container ID:  docker://3d22a9e647d4652227a9986f6940c6806e477f0b790a74f5795840131cc861ca
    Image:         samplekube.azurecr.io/sample:v1
    Image ID:      docker-pullable://samplekube.azurecr.io/sample@sha256:a814e92d5af97b8cfbd6cd0789e164858848f82f0316a771670382ce0bbcba92
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    State:         Waiting
      Reason:      CrashLoopBackOff
    Last State:    Terminated
      Reason:      ContainerCannotRun
      Message:     hcsshim::CreateComputeSystem 3d22a9e647d4652227a9986f6940c6806e477f0b790a74f5795840131cc861ca: The container operating system does not match the host operating system.
(extra info: {&quot;SystemType&quot;:&quot;Container&quot;,&quot;Name&quot;:&quot;3d22a9e647d4652227a9986f6940c6806e477f0b790a74f5795840131cc861ca&quot;,&quot;Owner&quot;:&quot;docker&quot;,&quot;VolumePath&quot;:&quot;\\\\?\\Volume{58649455-b9a5-4d00-b151-485ec8ab6006}&quot;,&quot;IgnoreFlushesDuringBoot&quot;:true,&quot;LayerFolderPath&quot;:&quot;C:\\ProgramData\\docker\
\windowsfilter\\3d22a9e647d4652227a9986f6940c6806e477f0b790a74f5795840131cc861ca&quot;,&quot;Layers&quot;:[{&quot;ID&quot;:&quot;7d7579eb-d8f7-5314-b6a0-399937aee9ca&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\e0357f9d6b48e4b580a09cefedec8aac329894b57a49a30f9dc27795a1626aca&quot;},{&quot;ID&quot;:&quot;f9bd195c-3ff
c-5c98-9713-1a7658666667&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\019404385f250e8807ea3b693e35813b3328b3a14e83da51e8119401f0d20f9f&quot;},{&quot;ID&quot;:&quot;0d763990-3499-5a19-b5e9-5e0788397f83&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\3be0598c3fa3671a1436c670b6964c0a30ddc
2bd2e4011f347e6ef503888826a&quot;},{&quot;ID&quot;:&quot;88fb7b4f-d24a-5ddf-9b67-861041ffef72&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\978600b419ddd768b0b03c09e198d7b8d411cc6ca63b5ba15b6cc5343bb8b2a7&quot;}],&quot;ProcessorWeight&quot;:5000,&quot;HostName&quot;:&quot;sample-deploy-548d6b9c6b-8v2nb&quot;,&quot;MappedDirect
ories&quot;:[{&quot;HostPath&quot;:&quot;c:\\var\\lib\\kubelet\\pods\\8257607b-9506-42af-9068-a3965bb46648\\volumes\\kubernetes.io~secret\\default-token-9wzn2&quot;,&quot;ContainerPath&quot;:&quot;c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount&quot;,&quot;ReadOnly&quot;:true,&quot;BandwidthMaximum&quot;:0,&quot;IOPSMaximum&quot;:0,&quot;Create
InUtilityVM&quot;:false}],&quot;HvPartition&quot;:false,&quot;NetworkSharedContainerName&quot;:&quot;fbd7d679302c57485ca7d4842528077fbb09e43ad691f47dd4cc84cbd8d3e3db&quot;})
      Exit Code:    128
      Started:      Thu, 02 Jul 2020 16:59:37 +0100
      Finished:     Thu, 02 Jul 2020 16:59:37 +0100
    Ready:          False
    Restart Count:  2
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-9wzn2 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-9wzn2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-9wzn2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  kubernetes.io/os=windows
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                From                   Message
  ----     ------     ----               ----                   -------
  Normal   Scheduled  67s                default-scheduler      Successfully assigned default/sample-deploy-548d6b9c6b-8v2nb to akswin000000
  Warning  BackOff    18s (x2 over 45s)  kubelet, akswin000000  Back-off restarting failed container
  Normal   Pulling    7s (x4 over 60s)   kubelet, akswin000000  Pulling image &quot;samplekube.azurecr.io/sample:v1&quot;
  Normal   Pulled     6s (x4 over 57s)   kubelet, akswin000000  Successfully pulled image &quot;samplekube.azurecr.io/sample:v1&quot;
  Normal   Created    5s (x4 over 57s)   kubelet, akswin000000  Created container sampleservice
  Warning  Failed     5s (x4 over 56s)   kubelet, akswin000000  Error: failed to start container &quot;sampleservice&quot;: Error response from daemon: hcsshim::CreateComputeSystem sampleservice: The container operating system does not match the host operating system.
(extra info: {&quot;SystemType&quot;:&quot;Container&quot;,&quot;Name&quot;:&quot;sampleservice&quot;,&quot;Owner&quot;:&quot;docker&quot;,&quot;VolumePath&quot;:&quot;\\\\?\\Volume{58649455-b9a5-4d00-b151-485ec8ab6006}&quot;,&quot;IgnoreFlushesDuringBoot&quot;:true,&quot;LayerFolderPath&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\sampleservice&quot;,&quot;Layers&quot;:[{&quot;ID&quot;:&quot;7d7
579eb-d8f7-5314-b6a0-399937aee9ca&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\e0357f9d6b48e4b580a09cefedec8aac329894b57a49a30f9dc27795a1626aca&quot;},{&quot;ID&quot;:&quot;f9bd195c-3ffc-5c98-9713-1a7658666667&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\019404385f250e8807ea3b693e35
813b3328b3a14e83da51e8119401f0d20f9f&quot;},{&quot;ID&quot;:&quot;0d763990-3499-5a19-b5e9-5e0788397f83&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\docker\\windowsfilter\\3be0598c3fa3671a1436c670b6964c0a30ddc2bd2e4011f347e6ef503888826a&quot;},{&quot;ID&quot;:&quot;88fb7b4f-d24a-5ddf-9b67-861041ffef72&quot;,&quot;Path&quot;:&quot;C:\\ProgramData\\do
cker\\windowsfilter\\978600b419ddd768b0b03c09e198d7b8d411cc6ca63b5ba15b6cc5343bb8b2a7&quot;}],&quot;ProcessorWeight&quot;:5000,&quot;HostName&quot;:&quot;sample-deploy-548d6b9c6b-8v2nb&quot;,&quot;MappedDirectories&quot;:[{&quot;HostPath&quot;:&quot;c:\\var\\lib\\kubelet\\pods\\8257607b-9506-42af-9068-a3965bb46648\\volumes\\kuber
netes.io~secret\\default-token-9wzn2&quot;,&quot;ContainerPath&quot;:&quot;c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount&quot;,&quot;ReadOnly&quot;:true,&quot;BandwidthMaximum&quot;:0,&quot;IOPSMaximum&quot;:0,&quot;CreateInUtilityVM&quot;:false}],&quot;HvPartition&quot;:false,&quot;NetworkSharedContainerName&quot;:&quot;fbd7d679302c57485ca7d4842528077
fbb09e43ad691f47dd4cc84cbd8d3e3db&quot;})
</code></pre>
<p>It seems to me is try to run the containers under linux instead of windows, I have both a windows and linux nodes in my cluster. How can I resolve this. Thanks</p>
<p>Below the <code>kubectl get nodes -o wide --show-labels</code></p>
<pre><code>NAME                                STATUS   ROLES   AGE     VERSION    INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION      CONTAINER-RUNTIME       LABELS
aks-agentpool-38156504-vmss000000   Ready    agent   5h17m   v1.15.11   10.240.0.4    &lt;none&gt;        Ubuntu 16.04.6 LTS               4.15.0-1089-azure   docker://3.0.10+azure   agentpool=agentpool,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=Standard_DS2_v2,beta.kubernetes.io/os=linux,failure-domain.beta.kubernetes.io/region=westeurope,failure-domain.beta.kubernetes.io/zone=0,kubernetes.azure.com/cluster=MC_testmass_anthonycluster_westeurope,kubernetes.azure.com/mode=system,kubernetes.azure.com/node-image-version=AKSUbuntu-1604-2020.06.18,kubernetes.azure.com/role=agent,kubernetes.io/arch=amd64,kubernetes.io/hostname=aks-agentpool-38156504-vmss000000,kubernetes.io/os=linux,kubernetes.io/role=agent,node-role.kubernetes.io/agent=,storageprofile=managed,storagetier=Premium_LRS
akswin000000                        Ready    agent   5h14m   v1.15.11   10.240.0.35   &lt;none&gt;        Windows Server 2019 Datacenter   10.0.17763.1282     docker://19.3.5         agentpool=win,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=Standard_DS2_v2,beta.kubernetes.io/os=windows,failure-domain.beta.kubernetes.io/region=westeurope,failure-domain.beta.kubernetes.io/zone=0,kubernetes.azure.com/cluster=MC_testmass_anthonycluster_westeurope,kubernetes.azure.com/node-image-version=AKSWindows-2019-17763.1282.200610,kubernetes.azure.com/role=agent,kubernetes.io/arch=amd64,kubernetes.io/hostname=akswin000000,kubernetes.io/os=windows,kubernetes.io/role=agent,node-role.kubernetes.io/agent=,storageprofile=managed,storagetier=Premium_LRS  
</code></pre>
<p>this is the yaml file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-deploy
  labels:
    app: sampleservice
spec:
  replicas: 3
  template:
    metadata:
      name: sampleservice
      labels:
        app: sampleservice
    spec:
      nodeSelector:
        &quot;kubernetes.io/os&quot;: windows
      containers:
      - name: sampleservice
        image: samplekube.azurecr.io/sample:v1
        imagePullPolicy: Always
      restartPolicy: Always    
  selector:
    matchLabels:
      app: sampleservice

---

apiVersion: v1
kind: Service
metadata:
  name: sample-service
spec:
  selector:
    app: sampleservice
  ports:
    - port: 80
  type: LoadBalancer
</code></pre>
<p>This is what I am getting now when describe a pod,</p>
<pre><code>Events:
  Type     Reason     Age                From                     Message
  ----     ------     ----               ----                     -------
  Normal   Scheduled  94s                default-scheduler        Successfully assigned default/sample-deploy-6d4b86bf46-djtvf to aksnpwin000000
  Normal   Pulled     31s (x4 over 82s)  kubelet, aksnpwin000000  Container image &quot;masskube.azurecr.io/sample2:v1&quot; already present on machine
  Normal   Created    31s (x4 over 82s)  kubelet, aksnpwin000000  Created container sampleservice
  Normal   Started    29s (x4 over 79s)  kubelet, aksnpwin000000  Started container sampleservice
  Warning  BackOff    3s (x5 over 59s)   kubelet, aksnpwin000000  Back-off restarting failed container
</code></pre>
<p>And this is what I get on the after running kubectl logs podname</p>
<pre><code>'Sample.exe' is not recognized as an internal or external command,
operable program or batch file.
</code></pre>

Garry A
<p>I have managed to resolve the issue by amending the docker file as follows,</p>
<pre><code>FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
WORKDIR /app
EXPOSE 80
COPY /bin/Release .
ENTRYPOINT [&quot;Sample.exe&quot;]
</code></pre>
<p>Thanks everyone for the help</p>
