kubernetes: K8s can't live without a default route

What happened?

Derived from https://github.com/projectcalico/calico/issues/8481

I use a virtual cluster with router VMs. When I start without any router VM, no default route is setup on the K8s nodes. This makes load-balancing to services to fail, at least with proxy-mode=iptables/nftables, and just about all CNI-plugins to fail. In short, the cluster is dead.

With proxy-mode=ipvs service routing works, but there are more subtle problems, e.g. Calico doesn’t start. I haven’t investigated further.

What did you expect to happen?

Well, to me it seems OK to require a default route, but the problem must be documented somewhere where cluster admins will see it.

I can’t really see any use-case where a default route is not set. Maybe when K8s is only used for SW-management, or security reasons.

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

In a test cluster:

  1. curl -k https://kluster-svc-address
  2. ip ro delete default
  3. curl -k https://kluster-svc-address

For instance on KinD:

root@default-control-plane:/# curl -k https://10.96.0.1
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "forbidden: User \"system:anonymous\" cannot get path \"/\"",
  "reason": "Forbidden",
  "details": {},
  "code": 403
}root@default-control-plane:/# ip ro del default
root@default-control-plane:/# curl -k https://10.96.0.1
curl: (7) Couldn't connect to server
root@default-control-plane:/# 

Anything else we need to know?

IMO this is a documentation issue.

/sig network /area kube-proxy /area documentation

Kubernetes version

All?

Cloud provider

N/A

OS version

N/A

Install tools

N/A

Container runtime (CRI) and version (if applicable)

crio version 1.28.1

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

Tested with Calico and Flannel (neither works without a default route)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (25 by maintainers)

Most upvoted comments

or something like “when setting up your cluster, you must ensure that your nodes are able to forward packets to the Service CIDR, this is commonly done by defining a default route, but in more complex network setups you must want to set it explicitly”

Well, to me it seems OK to require a default route, but the problem must be documented somewhere where cluster admins will see it.

related: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#network-setup

Note: If the host does not have a default gateway and if a custom IP address is not passed to a Kubernetes component, the component may exit with an error.

same page recommends to have a default route vs passing custom IPs to all components.