kube-proxy问题-尝试将Windows Worker节点添加到kubernetes集群

时间:2019-04-17 13:57:03

标签: docker kubernetes windows-server-2019

我正在尝试使用mcr.microsoft.com/windows/servercore:1809图片windows (server 2019) based docker container running inside a kubernetes cluster

来获取from here

该节点被集群识别并显示为就绪。

当我尝试将任何Pod部署到群集时,它可以正常运行,但是无法访问与该服务关联的公开端口。

在Windows worker节点上运行kube-proxy似乎存在问题。该节点的日志显示:

Failed create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "kube-proxy-nwclf": Error response from daemon: network host not found

关于我在哪里出问题的任何想法吗?

更新: 刚刚注意到,Windows机器上的kube-proxy pod具有一个基于群集的ip地址(10.244.5.2),而不是来自本地网络(192.168.1.X)的一个。就找出问题所在而言,这是否相关?

NAMESPACE     NAME                                 READY   STATUS              RESTARTS   AGE   IP             NODE              NOMINATED NODE   READINESS GATES
kube-system   kube-proxy-9jq8w                     1/1     Running             1          15d   192.168.1.9   k8s-mr        <none>           <none>
kube-system   kube-proxy-h5gx7                     0/1     ContainerCreating   0          13s   10.244.5.2     wins2019-worker   <none>           <none>

下面描述的pod中的详细信息。

user@k8s-mr:~/kube_projects/testdemo-4.1/app$ kubectl -n kube-system describe pod kube-proxy-nwclf
Name:               kube-proxy-nwclf
Namespace:          kube-system
Priority:           2000001000
PriorityClassName:  system-node-critical
Node:               wins2019-worker/192.168.1.10
Start Time:         Wed, 17 Apr 2019 13:35:30 +0100
Labels:             controller-revision-hash=b7775b676
                    k8s-app=kube-proxy
                    pod-template-generation=1
Annotations:        <none>
Status:             Pending
IP:                 192.168.1.10
Controlled By:      DaemonSet/kube-proxy
Containers:
  kube-proxy:
    Container ID:
    Image:         k8s.gcr.io/kube-proxy:v1.14.0
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      /usr/local/bin/kube-proxy
      --config=/var/lib/kube-proxy/config.conf
      --hostname-override=$(NODE_NAME)
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:
      NODE_NAME:   (v1:spec.nodeName)
    Mounts:
      /lib/modules from lib-modules (ro)
      /run/xtables.lock from xtables-lock (rw)
      /var/lib/kube-proxy from kube-proxy (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-proxy-token-f4tqx (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-proxy:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      kube-proxy
    Optional:  false
  xtables-lock:
    Type:          HostPath (bare host directory volume)
    Path:          /run/xtables.lock
    HostPathType:  FileOrCreate
  lib-modules:
    Type:          HostPath (bare host directory volume)
    Path:          /lib/modules
    HostPathType:
  kube-proxy-token-f4tqx:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  kube-proxy-token-f4tqx
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:
                 CriticalAddonsOnly
                 node.kubernetes.io/disk-pressure:NoSchedule
                 node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/network-unavailable:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute
                 node.kubernetes.io/pid-pressure:NoSchedule
                 node.kubernetes.io/unreachable:NoExecute
                 node.kubernetes.io/unschedulable:NoSchedule
Events:
  Type     Reason                  Age                From                      Message

------

  Normal   Scheduled               70s                default-scheduler         Successfully assigned kube-system/kube-proxy-nwclf to wins2019-worker
  Normal   SandboxChanged          2s (x12 over 61s)  kubelet, wins2019-worker  Pod sandbox changed, it will be killed and re-created.
  Warning  FailedCreatePodSandBox  0s (x13 over 62s)  kubelet, wins2019-worker  Failed create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "kube-proxy-nwclf": Error response from daemon: network host not found

1 个答案:

答案 0 :(得分:1)

现在已解决,我误解了kube-proxy根本不应在Windows节点上运行。

我必须修改kubernetes主目录,并应用NodeSelector以确保根据每个节点的OS为其设置适当的Pod。

wget https://raw.githubusercontent.com/Microsoft/SDN/master/Kubernetes/flannel/l2bridge/manifests/node-selector-patch.yml
kubectl patch ds/kube-proxy --patch "$(cat node-selector-patch.yml)" -n=kube-system