Kubernetes windows hyper-v no network in pod

8/1/2018

So my goal is to use my Windows Server version 1803 worker so it can run images from older Windows Server version like 2016.

Both my master and worker nodes are in offline environment.

In order to do that I followed this tutorial with Host-gateway setup and also I upgraded Kubernetes binaries version to v1.10.6 on both Ubuntu master and Windows node because v1.9 doesn't support hyperv isolation.

With option --isolation=hyperv, I am able to run such images and connect with them via container 172... address, but this is directly via docker, outside Kubernetes.

I also am able to add this worker node to Ubuntu 16.04 master and deploy pod and services that are based on native Windows 1803 images and connect with them from master.

But when I start kubelet on windows with hyperv enabled:

    c:\k\kubelet.exe --hostname-override=$(hostname) --v=6 `
    --pod-infra-container-image=kubeletwin/pause --resolv-conf="" `
    --allow-privileged=true --enable-debugging-handlers `
    --cluster-dns=$KubeDnsServiceIp --cluster-domain=cluster.local `
    --kubeconfig=c:\k\config --hairpin-mode=promiscuous-bridge `
    --image-pull-progress-deadline=20m --cgroups-per-qos=false `
    --feature-gates=HyperVContainer=true --enforce-node-allocatable="" `
    --network-plugin=cni --cni-bin-dir="c:\k\cni" --cni-conf-dir "c:\k\cni\config"

And apply this yaml: https://pastebin.com/raw/bbibyb9s

Then every pod, deployment, service says everything was successful, but I have no connection to this pod from everywhere, even from Windows worker node it is on.

When I check its routes via:

kubectl exec -it win-webserver-d6b66d575-svc55 -c windowswebserver route print

I see no connection outside.

Also my routing using host-gw is a little different since gateway 192.168.1.2 did not work for me so I changed this:

route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.2 dev ens160

For this:

route add -net 192.168.1.0 netmask 255.255.255.0 gw <WINDOWS_NODE_IP> dev ens160

I changed AddRoutes.ps1 on Windows similarly. And this worked for not-hyperv pods.

When I inspected this not working docker container, in HostConfig

"NetworkMode" had value "none",

when on working not hyperv pod container there was

"NetworkMode": "container:0bbdc2d0c07c553edc755ecd24fab932ad26ca78d17f9d6ab4e377fb1fdef73d",

and on non Kubernetes but hyperv container there was

"NetworkMode": "default".
-- Mathematicmaster
docker
hyper-v
kubernetes
windows

0 Answers