Namespaces¶
- Used to organize resources
- Virtual cluster inside of a Kubernetes cluster
- Most resources cannot be shared across namespaces
- ConfigMap
- Secrets
- Pods
- Services can be shared across namespaces
- Components that don't belong to a namespace. They live globally inside the cluster.
- Volumes
- Nodes
Default Namespaces¶
- By default, a K8s cluster has 4 namespaces
- kube-system
- Contains system, master & kubectl processes
- Do not create or modify anything in kube-system namespace
- kube-public
- Contains a configmap, which stores publicly accessible data
- kube-node-lease
- Contains information about the heartbeats of nodes
- Each node has an associated lease object which stores information about the availability of that node
- default
- Default namespace where you will be creating resources
- kube-system
Custom Namespaces¶
- You can create a custom namespace using
- Kubectl -
kubectl create namespace <namespace-name>
- KubeConfig file - specify namespace for each component (recommended)
- Kubectl -
Use Cases¶
- Grouping resources
- Multiple teams
- Example: two or more teams working on the same app where each team works in their own namespace without disrupting the other
- Resource sharing
- Example: reuse Elastic Stack in both development and staging environments or between blue/green deployment versions
- Access limiting
- Example: limiting access to dev namespace for support team
- Resource allocation
- Allocate resources (CPU, RAM, etc.) to different namespaces
Last updated: 2022-09-04