Problem scenario
Your pods are not ready in Kubernetes. "kubectl describe pods" results may have errors like this:
Warning FailedCreatePodSandBox 4m57s (x2035 over 69m) kubelet (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "abcd1234" network for pod "apache-tomcat-deployment": networkPlugin cni failed to set up pod "apache-tomcat-deployment" network: open /run/flannel/subnet.env: no such file or directory
(The symptoms of this problem will involve pods and nodes not being ready. You may go to an load balancer URL, but the page will not load. It is supposed to be an ingress to a Kubernetes web application. You expect to see a regular web page.)
What should you do?
Solution
Create the /run/flannel/subnet.env file. The pods will come back right away without you doing anything.
Here is the content of the file:
FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
echo "
FLANNEL_NETWORK=10.244.0.0/16 \
FLANNEL_SUBNET=10.244.0.1/24 \
FLANNEL_MTU=1450 \
FLANNEL_IPMASQ=true" > /run/flannel/subnet.env