Namespace Management

In a Kubernetes cluster, workloads are deployed in a certain namespace. Multi-cluster deployments mean multiple namespaces. If you want to manage them in a unified manner, karmada-controller-manager will be the solution for you, which propagates the namespace you created in Karmada to member clusters.

Default namespace propagation

All namespaces, except those reserved, will be automatically propagated to all member clusters. Reserved namespaces are karmada-system,karmada-cluster, karmada-es-*, kube-*, and default.

Skip namespace auto propagation

If you don’t want to propagate a namespace automatically, configure karmada-controller-manager or label the namespace.

Configuring karmada-controller-manager

Flag skipped-propagating-namespaces could be configured to skip namespace auto propagation in karmada-controller-manager. Here is an example:

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: karmada-controller-manager
  5. namespace: karmada-system
  6. labels:
  7. app: karmada-controller-manager
  8. spec:
  9. ...
  10. template:
  11. metadata:
  12. labels:
  13. app: karmada-controller-manager
  14. spec:
  15. containers:
  16. - name: karmada-controller-manager
  17. image: docker.io/karmada/karmada-controller-manager:latest
  18. command:
  19. - /bin/karmada-controller-manager
  20. - --skipped-propagating-namespaces=ns1,ns2

ns1 and ns2 will not be propagated to all the member clusters.

Labeling the namespace

Label namespace.karmada.io/skip-auto-propagation: "true" could be configured to skip namespace auto propagation. Here is an example:

  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: example-ns
  5. labels:
  6. namespace.karmada.io/skip-auto-propagation: "true"

Note: If the namespace has been propagated to member clusters, labeling the namespace with namespace.karmada.io/skip-auto-propagation: "true" will not trigger member clusters to delete the namespace, but the namespace will not be propagated to newly joined member clusters.