How to start a sleeping powershell on Google Kubernetes Engine with Beta Windows containers/nodes?

1/29/2020

I can't seem to figure out why a pod as simple as

apiVersion: v1
kind: Pod
metadata:
  name: win-test
spec:
  containers:
    - name: shell
      image: "mcr.microsoft.com/windows/servercore:1809"
      command:
        - powershell
      args:
        - "Start-Sleep"
        - "999999"
      imagePullPolicy: IfNotPresent
  nodeSelector:
    kubernetes.io/os: windows

fails to start due to

failed to start container "4f4e02205101779ffef6e6bad6f7bc8d94da1dafa4173de5b87bb3a98508c776": Error response from daemon: CreateComputeSystem 4f4e02205101779ffef6e6bad6f7bc8d94da1dafa4173de5b87bb3a98508c776: The system cannot find the file specified. (extra info: {"SystemType":"Container","Name":"4f4e02205101779ffef6e6bad6f7bc8d94da1dafa4173de5b87bb3a98508c776","Owner":"docker","VolumePath":"\\\\?\\Volume{852ddcc4-3819-442f-8748-ab95850656ee}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\4f4e02205101779ffef6e6bad6f7bc8d94da1dafa4173de5b87bb3a98508c776","Layers":[{"ID":"f19b83e5-b168-56b9-aadd-5aa5ded15656","Path":"C:\\ProgramData\\docker\\windowsfilter\\a2c514d945fb21b87e5188e8df2ac52d95d727e2c9081a526719b1a0cc504403"},{"ID":"e3aef991-6354-522e-8f9e-f68a75bbf653","Path":"C:\\ProgramData\\docker\\windowsfilter\\8a82b1f3ce35668195c9f27a15736f0b1c20cd3fcb1f99341ec56db5ce7775f1"}],"ProcessorWeight":5000,"HostName":"win-test","MappedDirectories":[{"HostPath":"c:\\var\\lib\\kubelet\\pods\\87884b53-b09b-4ec3-87e6-6cec2e1c9d43\\volumes\\kubernetes.io~secret\\default-token-nk777","ContainerPath":"c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount","ReadOnly":true,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"HvPartition":false,"NetworkSharedContainerName":"b84c2337fa12b3d9f7228bba3c7d0c0a321270df6c693da0bb4b08e35366b6ea"}): RunContainerError

I'm expecting the container in the pod to start a powershell which then lives for 999999 seconds before the container succeeds.

I'm using a GKE Beta Cluster 1.16.4-gke.22.

-- Karl Richter
google-kubernetes-engine
kubernetes
windows

1 Answer

2/4/2020

TL;DR

just switch the container image version to newer one, 1903:

"mcr.microsoft.com/windows/servercore:1903"

Longer story:

Your container image version must match with container host version, which is not in your case (please read the principales that describe it on MS sites, here, including practical examples)

Currently you are trying to run container image with OS Version: 10.0.17763.* on top of container host with OS Version: 10.0.18363.* - I assume your Windows worker nodes are based on windows-server-1909 VM image.

Please check here for general OS Version/OS Build mapping of current Windows Server versions.

If you really need to run this specific container image version (1809) of MS Server Core, spin up another worker nodes basing on older (matching) VM image version.

-- Nepomucen
Source: StackOverflow