#KubernetesSummarySeries - Module 4 [K8s Namespaces]

#KubernetesSummarySeries - Module 4 [K8s Namespaces]

What is a Namespace ?

Namespaces are a native way to divide a single Kubernetes cluster into multiple virtual clusters.

They are designed to apply quotas and policies to groups of objects. If the explicit target namespace is not defined , the object is deployed in the default namespace.

It is a mechanism for isolating groups of resources within a single cluster.

Kubernetes Sample Namespace

Initial namespaces

?? Default

?? kube-node-lease

?? kube-public

?? kube-system


Deploying to Namespaces

Two ways to deploy objects to a specific namespace -

?? Imperatively - This method requires you to add the -n or --namespace flag to commands.

?? Declaratively - This method specifies the namespace in the YAML manifest file.


Namespace basic commands

kubectl create ns <namespace-name>        
kubectl apply -f <namespace-yaml>        
kubectl get pods --namespace=<namespace-name>        
kubectl api-resources        
kubectl get namespaces --show-labels        
kubectl get ns        
kubectl describe ns default        
kubectl get svc --namespace <namespace-name>        
kubectl delete ns <namespace-name>        

Namespace YAML

Namespace YAML

When to Use Multiple Namespaces ?

Namespaces provide a scope for names. Names of resources need to be unique within a namespace but not across namespaces. Namespaces cannot be nested inside one another and each Kubernetes resource can only be in one namespace.

Namespaces are a way to divide cluster resources between multiple users.


?? Stay Tuned for More !

I will be sharing more insights in the upcoming articles of our #KubernetesSummarySeries. Make sure you follow ??Gaurav Sharma to stay updated and not miss out on the next chapters of this series !

#Kubernetes #CloudNative #DevOps #Microservices #Containerization #Automation #Scalability #Innovation #TechTrends #SoftwareDevelopment


要查看或添加评论,请登录

Gaurav Sharma的更多文章

社区洞察

其他会员也浏览了