kubernetes: NodeLifeCycleController: all pods are marked as not ready making workload services unavailable during network partition b/w master & worker nodes

What happened?

We’ve encountered a failure scenario in production where if master nodes hosting etcd, apiserver, controller-manager etc gets network partitioned with worker nodes (say due to apiserver lb outage or a widespread network infra outage), all the pods hosted in that k8s cluster gets marked as not ready making endpoint controller remove the pods IP addresses from all services matching them. It causes a widespread outage for all the service workloads hosted on that kubernetes cluster as pods are marked as not ready even though all the containers comprising them are ready.

What did you expect to happen?

We expected only pods that are marked for eviction during the above circumstances to be marked as not ready. It’ll help us in delaying or eventually stopping a widespread workloads service unavailability.

How can we reproduce it (as minimally and precisely as possible)?

  • Host a few load balancer/clusterIP services in k8s cluster.
  • Create a network partition between master & worker nodes (using iptable rules or something similar). Each master node is able to connect each other and deployed with components stacked together hosting etcd, apiserver, controller-manager, cloud-controller, scheduler, cni etc.
  • You can see that the load balancer external IP address is not able to route traffic to pods since addresses are removed from the endpoint resource after the node lifecycle controller marking pods as not ready.

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-13T19:50:45Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"132a687512d7fb058d0f5890f07d4121b3f0a2e2", GitTreeState:"clean", BuildDate:"2021-05-12T12:32:49Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

On-Premise Infrastructure.

OS version


$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ uname -a
Linux xxx-master-1 5.10.0-0.bpo.3-cloud-amd64 #1 SMP Debian 5.10.13-1~bpo10+1 (2021-02-11) x86_64 GNU/Linux

Install tools

Container runtime (CRI) and and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 42 (24 by maintainers)

Most upvoted comments

/remove-sig network

as a side comment. There is two opposing forces. From networking standpoint. if pods are not ready then the LB controller must assume that they are not functional and start routing the traffic away frpm them (specially in “multi tenant” cluster). Consider the case of network partition and pods restarted with different ips, that may mean that LBs are now - not just pointing to wrong addresses, black-holed - but may pointing to wrong tenant.

We are not suggesting that the LB controller should stop posting updates. It should continue to post updates and any pod restarts resulting in the pod getting a new IP should be posted as an update by the LB controller. We want the rate at which pods are marked as NotReady due to the Node being NotReady to be controlled and capped at an upper limit.

Maybe we should think about why rate limits on eviction were created. One reason as per docs is one AZ getting partitioned from the control plane. This is the exact some scenario we are trying to address.

Lets consider an example where the rate limits on api based eviction is trying to limit a cluster wide application outage due to control plane partition. Status of almost all nodes in the AZ wouId’ve been marked as False or Unknown. In this case, secondary eviction rate would’ve kicked in. But since the status of nodes in AZ are either Unknown or False, the status of pods hosted on nodes in that AZ will also be marked as NotReady by the Node Lifecycle Controller. Hence even though the pod eviction was slowed down, the traffic received by the application ELBs for pods in that AZ would’ve reduced to 0 immediately(coderef) because the pods were marked as NotReady due to the control plane partition. This would render the pod eviction rate limit feature ineffective as pods would stop receiving traffic. Once pods stop receiving traffic, protecting them from eviction would not really be useful in avoiding a wide outage.

Internally we had avoided this issue by sending all pods(including ones that are marked as NotReady) to LB control plane in the ensureLoadBalancer implementation of Cloud Controller Manager. In our internal LB control plane, healthchecks are done for endpoints behind an LB as they serve both VM workloads and k8s workloads. This decoupled k8s control plane outages from application availability.

Now we are migrating to istio where this would again be a problem since istio doesn’t implement its own healthchecking and relies on the endpoints object. So now when pods are marked as NotReady in bulk due to control plane partition, Istio’s load balancing would stop sending traffic to all the pods in that specific AZ causing a AZ wide outage(across tenants) even though the applications were still healthy.

We expected only pods that are marked for eviction during the above circumstances to be marked as not ready. It’ll help us in delaying or eventually stopping a widespread workloads service unavailability.

I’m not sure I understand why you’d expect only pods marked for eviction to be marked “Not Ready”.

If you have a network partition that completely severs the control plane from worker nodes, it makes sense to me that the node lifecycle controller would label those pods as not ready, since the control plane cannot contact them. Readiness is a control plane concept that indicates whether or not a pod can serve load balancer traffic. If the control plane can’t contact a node, then it can’t load balance requests to that node.

This to me sounds like it’s working as expected. Your workloads will still be running; they just can’t serve network traffic (which makes sense because your network is fully partitioned).

/remove-sig api-machinery /sig network /close