I am using Kubectl 1.20.2 on the client side and 1.18.9 on the server side. I have deployed EKS, and I have created a cluster. The pods never become ready unless I manually log into the worker nodes and create an /run/flannel/subnet.env file.
I use these four lines for each worker node:
FLANNEL_NETWORK=10.244.0.0/16 FLANNEL_SUBNET=10.244.0.1/24 FLANNEL_MTU=1450 FLANNEL_IPMASQ=true
It sometimes works. But when the EC-2 servers get rebooted, this file gets deleted. I know how to pass an AMI with the command I use to create the nodes, but I would rather not have an AMI image to maintain. Is there a recommended way of creating this file /run/flannel/subnet.env? I was thinking of trying to user user data, but this seems somewhat involved. It seems like I did something wrong in deploying flannel when the worker nodes do not have this file.
When I run
kubectl describe pods I sometimes get the error
failed to set up sandbox container ... network for pod "foobar": networkPlugin cni failed to set up pod "another_name" network: invalid CIDR address:
So maybe this file's IP addresses are not correct. I have tried using unique IP addresses in the files on the worker nodes, but this did not help.
What is common for creating the subnet.env file on the worker nodes? My method is manual and not reliable.