Namespace — virtual cluster partition for resource isolation.
1apiVersion: v12kind: Namespace3metadata:4 name: production5 labels:6 env: production7 pod-security.kubernetes.io/enforce: restricted8---9# ResourceQuota10apiVersion: v111kind: ResourceQuota12metadata:13 name: compute-quota14 namespace: production15spec:16 hard:17 requests.cpu: "8"18 requests.memory: "16Gi"19 pods: "50"20---21# LimitRange22apiVersion: v123kind: LimitRange24metadata:25 name: default-limits26 namespace: production27spec:28 limits:29 - type: Container30 default:31 cpu: "500m"32 memory: "256Mi"
1kubectl create namespace staging2kubectl get namespaces3kubectl config set-context --current --namespace=production