![在 kubernetes 集群中运行 Windows 工作节点时出现问题 - 操作系统不匹配?](https://linux22.com/image/1588614/%E5%9C%A8%20kubernetes%20%E9%9B%86%E7%BE%A4%E4%B8%AD%E8%BF%90%E8%A1%8C%20Windows%20%E5%B7%A5%E4%BD%9C%E8%8A%82%E7%82%B9%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98%20-%20%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E4%B8%8D%E5%8C%B9%E9%85%8D%EF%BC%9F.png)
我正在尝试基于 Windows(Server 2019)的 Docker 容器在 kubernetes 集群内运行,使用mcr.microsoft.com/windows/servercore:1809
图像从这里
部署容器时,出现以下错误:
The container operating system does not match the host operating system
仔细检查了容器和主机节点(Windows Server 2019 数据中心系统)中的操作系统后,两者显示相同的内容:
Microsoft Windows [Version 10.0.17763.437]
docker 容器直接在主机系统上(而不是在 kubernetes 集群内)运行正常
知道哪里出了问题吗?
下面的细节describe pod
。
user@k8s-mstr:~/kube_projects/testdemo-4.1/app$ kubectl -n test describe pod test-7b8d99f8f9-ksnnp
Name: test-7b8d99f8f9-ksnnp
Namespace: test
Priority: 0
PriorityClassName: <none>
Node: wins2019-worker/192.168.1.10
Start Time: Wed, 17 Apr 2019 11:50:00 +0100
Labels: io.kompose.service=test
pod-template-hash=7b8d99f8f9
Annotations: <none>
Status: Pending
IP:
Controlled By: ReplicaSet/test-7b8d99f8f9
Containers:
test:
Container ID:
Image: test:wins19.4.2.1
Image ID:
Port: 8075/TCP
Host Port: 0/TCP
Args:
python
hello.py
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-xtwkj (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-xtwkj:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-xtwkj
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
------
Warning FailedScheduling 63s (x5 over 4m12s) default-scheduler 0/3 nodes are available: 1 node(s) had taints that the pod didn't tolerate, 2 node(s) didn't match node selector.
Normal Scheduled 61s default-scheduler Successfully assigned test/test-7b8d99f8f9-ksnnp to wins2019-worker
Warning FailedCreatePodSandBox 56s kubelet, wins2019-worker Failed create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "test-7b8d99f8f9-ksnnp": Error response from daemon: CreateComputeSystem 4e42952b56de687e7c784aa1b72e8f2079ec945fdbea6f5dbe173c7acf1e8fc8: The container operating system does not match the host operating system.
(extra info: {"SystemType":"Container","Name":"4e42952b56de687e7c784aa1b72e8f2079ec945fdbea6f5dbe173c7acf1e8fc8","Owner":"docker","VolumePath":"\\\\?\\Volume{668e77e8-1d2d-46e7-84c1-364be7ad7d68}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\4e42952b56de687e7c784aa1b72e8f2079ec945fdbea6f5dbe173c7acf1e8fc8","Layers":[{"ID":"7f4bd9df-f1ea-5927-bd98-14abd0c7140c","Path":"C:\\ProgramData\\docker\\windowsfilter\\6c6b5d97817dbf136d7ec79febda2a3f3397d855fe7d1e933b23728af95b6a0b"},{"ID":"f87834c9-c212-535a-b960-95f16ca44177","Path":"C:\\ProgramData\\docker\\windowsfilter\\edd108b444a8be7be8d412a85c762633094daf6c2e97f51e023cab8508cf2a76"},{"ID":"6a0b1067-e6a2-5532-b748-ad376af5862c","Path":"C:\\ProgramData\\docker\\windowsfilter\\25a5e85c88cd9d6394752b3d8d6235a3e4a502b2b3864665c16f2a14fab50215"}],"ProcessorWeight":2,"HostName":"test-7b8d99f8f9-ksnnp","HvPartition":false})
答案1
我错过了这一关键阶段并没有被标记microsoft/nanoserver:1809
为microsoft/nanoserver:latest
解决这个问题,然后重新运行,.\start.ps1
以便kubeletwin/pause
从正确的图像重建图像。
然后 pod 开始运行,没有任何错误