network: read /run/flannel/subnet.env: The handle is invalid

4/10/2020

I have 3 node kubernetes cluster with 2 linux ( 1 master & 1 worker ) and 1 windows server 2019 core virtual machines. I tried to deploy windows application on that but is giving error network: read /run/flannel/subnet.env: The handle is invalid.

I tried by doing this:

kubeadm init  --pod-network-cidr=10.244.0.0/16

I can deploy linux applications only problem with windows applications. Pods are scheduling to the windows worker node but none of them are running, all are in container creating state. When I check the logs above is the error for every pod.

Below is the output of .\flanneld.exe on Windows VM:

> I0410 15:07:01.699217   11704 main.go:514] Determining IP address of default interface I0410 15:07:02.023840   11704 main.go:527] Using
> interface with name vEthernet (Ethernet0) and address <IP Address>  
> I0410 15:07:02.023840   11704 main.go:544] Defaulting external address
> to interface address (<IP Address>) E0410 15:07:02.026800   11704
> main.go:605] Couldn't fetch previous FLANNEL_SUBNET from subnet file
> at /run/flannel/subnet.env: read /run/flannel/subnet.env: The handle
> is invalid. I0410 15:07:02.026800   11704 main.go:244] Created subnet
> manager: Etcd Local Manager with Previous Subnet: None I0410
> 15:07:02.027804   11704 main.go:247] Installing signal handlers E0410
> 15:07:04.034674   11704 main.go:382] Couldn't fetch network config:
> client: etcd cluster is unavailable or misconfigured; error #0: dial
> tcp 127.0.0.1:2379: connectex: No connection could be made because the
> target machine actively refused it. ; error #1: dial tcp
> 127.0.0.1:4001: i/o timeout timed out E0410 15:08:14.027848   11704 main.go:382] Couldn't fetch network config: client: etcd cluster is
> unavailable or misconfigured; error #0: dial tcp 127.0.0.1:2379: i/o
> timeout ; error #1: dial tcp 127.0.0.1:4001: i/o timeout timed out
> E0410 15:08:17.053635   11704 main.go:382] Couldn't fetch network
> config: client: etcd cluster is unavailable or misconfigured; error
> #0: dial tcp 127.0.0.1:2379: i/o timeout ; error #1: dial tcp 127.0.0.1:4001: i/o timeout

Output of C:\run\flannel\subnet.exe:

> FLANNEL_NETWORK=10.244.0.0/16 
> FLANNEL_SUBNET=10.244.1.1/24
> FLANNEL_MTU=1450 
> FLANNEL_IPMASQ=true
-- Priyanka
kubernetes
windows

1 Answer

4/16/2020

I have resolved it by redeploying flannel on windows because first when I deployed it /run/flannel/subnet.env was not there then I manually created /run/flannel/subnet.env and kept the info as I mentioned above. Later I tried to deploy windows application on cluster again got an error flanneld service is misconfigured. so i have redeployed it.

-- Priyanka
Source: StackOverflow