Kubectl Namespaces
Isolate teams and environments with namespaces and quotas.
- kubernetes namespace
- kubectl ns
- resource quota
- isolate env
- delete namespace
Kubectl Namespaces
Isolate teams and environments with namespaces and quotas.
Commands
| Command | What it does |
|---|---|
kubectl get ns | List namespaces |
kubectl create ns shop | Create one |
kubectl get all -n shop | Everything inside a namespace |
kubectl delete ns shop-old | Delete a namespace and its contents |
kubectl top pods -n shop | Resource usage per pod |
Example
kubectl create ns shop
kubectl config set-context --current --namespace=shop
kubectl get all -n shop
FAQ
What does deleting a namespace do?
Deletes every namespaced object inside — a fast environment teardown, but irreversible.
How do I prevent one team starving others?
ResourceQuotas plus LimitRanges per namespace cap total and per-pod consumption.
常见问题
What does deleting a namespace do?
Deletes every namespaced object inside — a fast environment teardown, but irreversible.
How do I prevent one team starving others?
ResourceQuotas plus LimitRanges per namespace cap total and per-pod consumption.
Kubernetes
Kubectl Config and Context
Point kubectl at the right cluster and switch contexts safely.
Kubectl Pods
Inspect pods, describe failures, and get a shell inside.
Kubectl Deployments
Create, update, and inspect Deployments that own your pods.
Kubectl Services
Expose pods stably with ClusterIP, NodePort, and LoadBalancer.