Tenant isolation with Kubernetes on networking lev

2020-08-02 07:32发布

问题:

We want to run a multi-tenant scenario that requires tenant separation on a network level.

The idea is that every tenant receives a dedicated node and a dedicated network that other tenants nodes can join. Tenant nodes should be able to interact with each other in that network.

Networks should not be able to talk with each other (true network isolation).

Are there any architectural patterns to achieve this?

  • One Kubernetes cluster per tenant?
  • One Kubernetes cluster for all tenants, with one subnet per tenant?
  • One Kubernetes cluster across VPCs (speaking in AWS terms)?

回答1:

The regular way to deal with multi-tenancy inside kubernetes is to use namespaces. But this is within a kube cluster, meaning you still have the same underlying networking solution shared by all tenants. That is actualy fine, as you have Network Policies to restrict networking in the cluster.

You can obviously run autonomous clusters per tenant, yet this is not exactly multi-tenancy then, just multiple clusters. Networking can be configured on node level to route as expected, but you'd still be left with an issue of cross-cluster service discovery etc. Federation can help a bit with that, but I would still advise to chase Namespaces+Policies approach.



回答2:

I see four ways to run multi-tenant k8s clusters at network-level:

  1. Namespaces
  2. Ingress rules
  3. allow/deny and ingress/egress Network Policies
  4. Network-aware Zones