Namespace
Think of a Namespace as a virtual cluster or compartment housing a collection of related resources and objects. This concept allows you to group and categorize entities like deployments, pods, services, and replication controllers based on projects or user groups. By default, these all belong to the 'default' namespace. However, 'nodes', 'persistent volumes', and namespaces themselves are not subordinate to any namespace.
You might find Namespaces being put to use to isolate users. For instance, Kubernetes' built-in services typically run in the kube-system
namespace.
Mastering Namespace Operations
The Kubernetes command-line tool
kubectl
lets you specify a namespace using the--namespace
or shorter-n
option. If you don't specify one, it assumes 'default'. To view resources across all namespaces, set--all-namespace=true
.
Searching
Note: Keep an eye on the status - it'll indicate if a namespace is "Active" or in the process of being "Terminated". During the deletion process, the namespace status changes to "Terminating".
Creating
Note: Make sure your namespace name matches this regular expression [a-z0-9]([-a-z0-9]*[a-z0-9])?
and doesn't exceed 63 characters in length.
Deleting
Take heed:
Deleting a namespace automatically takes out all the resources belonging to that namespace as well.
The
default
andkube-system
namespaces are off-limits for deletion.While a PersistentVolume doesn't belong to any namespace, a PersistentVolumeClaim is tied to a specific namespace.
The namespace association of an Event depends on its source object.
With version v1.7 came the
kube-public
namespace for storing public information, usually in the form of ConfigMaps.
For Further Reading
最后更新于