Skip to content

Standard label to identify "system" vs "user" namespaces #5708

@danwinship

Description

@danwinship

Enhancement Description

  • One-line enhancement description (can be used as a release note): Standard label to identify "system" vs "user" namespaces

  • Kubernetes Enhancement Proposal:

  • Discussion Link: discussion below

  • PRs by stage and milestone:

    • Alpha - v1.xx
      • KEP (k/enhancements) update PR(s):
      • Code (k/k) update PR(s):
      • Docs (k/website) update PR(s):

Please keep this description up to date. This will help the Enhancement Team to track the evolution of the enhancement efficiently.


The idea is that real-world use of ClusterNetworkPolicy will likely require a way to distinguish "system" namespaces (eg, default and kube-system in a basic vanilla k8s cluster) from "user" namespaces, so that admins can write policies that apply to all user workloads without worrying that they will accidentally break the cluster infrastructure. There may be a use case for more than just "system" vs "user".

For example, our own documentation on "Securing a Cluster" suggests restricting access to cloud metadata APIs. But components like the cloud provider and cloud-specific ingress/gateway controllers may need access to it (and in some clouds, the upstream DNS server has the same IP as the metadata API, so CoreDNS would also need access to it). So administrators would want to be able to write a policy that prevents "user workload" namespaces from accessing the metadata IP without blocking "cluster infrastructure" namespaces. And ideally, we would like to be able to provide an example of such a ClusterNetworkPolicy in the doc:

apiVersion: policy.networking.k8s.io/v1alpha2
kind: ClusterNetworkPolicy
metadata:
  name: block-user-namespaces-from-metadata-api
spec:
  tier: Admin
  priority: 100 # adjust as appropriate
  subject:
    namespaces:
      matchExpressions:
      - # FIXME: fill this part in
  egress:
  - action: "Deny"
    to:
    - networks:
      # This is the IP used by GCP, AWS, and Azure, but other clouds may
      # use different IPs...
      - 169.254.169.254/32

But without a distribution-independent way of distinguishing "user workload" and "cluster infrastructure" components, we can't fill in the actual matchExpressions.

/sig network architecture
/help

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.sig/architectureCategorizes an issue or PR as relevant to SIG Architecture.sig/networkCategorizes an issue or PR as relevant to SIG Network.

    Type

    No type

    Projects

    Status

    Help needed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions