Run .NET container on Windows Server 2022

10/11/2021

Both host and container cmd /c ver return 10.0.20348.230 but still Kubernetes complains that The container operating system does not match the host operating system. Any ideas?

apiVersion: v1
kind: Pod
metadata:
  name: aspnet-test
spec:
  containers:
  - image: mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022
    name: aspnet-test
    ports:
    - containerPort: 80
      name: http
      protocol: TCP
  nodeSelector:
    kubernetes.io/os: windows

docker run -it -p 5000:80 mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022 works. The image was downloaded by this command, so Kubernetes decided about the error before fetching it.

Retested with Microk8s and Kubernetes 1.22.3.

-- Jan Zahradník
kubernetes
windows-container
windows-server-2022

0 Answers