(18) Kubernetes Practical Introduction - Namespace

One, NameSpace concept

  1. Namespace is a very important resource in the kubernetes system. Its main function is to realize resource isolation of multiple environments or multi-tenant resource isolation.
  2. By default, all pods in the kubernetes cluster can access each other. But in practice, you may not want to allow the two pods to access each other. At this time, you can add two pods and divide them into different namespaces. Kubernetes can allocate resources within the cluster to different namespaces. Form a logical "group" to facilitate the isolated use and management of resources of different groups.
  3. Through the authorization mechanism of kubernetes, different namespaces can be handed over to different tenants for management, so that multi-tenant resource isolation is realized. At this time, the resource quota mechanism of kubernetes can also be integrated to limit the resources that different tenants can occupy, such as cpu Usage, memory usage, to realize the management of tenants' available resources.
    Insert picture description here

Two, kubernetes default ns

After the kubernetes cluster is started, a default namespace will be created:

kubectl get namespace

Four default namespaces will be found, as follows:

1) default: The default namespace. When resources do not specify a namespace, they are created under this namespace
2) kube-system: The objects created by the K8s system are under this namespace
3) kube-public: This namespace is visible to all users (including unauthorized users), Usually used as a reserved resource for the cluster.
4) kube-node-lease: This namespace is used for Lease objects related to each node; the design of this object improves the performance of node heartbeat detection when the cluster is large

Third, the operation of the namespace

  1. View all ns
kubctl get ns
  1. View the specified ns
kubectl get ns default
  1. see details
kubectl describe ns default
  1. create
kubectl create ns dev
  1. delete
kubectl delete ns dev
  1. Create
    a ns-dev.yaml file by creating ns in configuration mode :
apiVersion: v1
kind: Namespace
metadata: 
	name: dev

Excuting an order

#创建
kubectl create -f ns-dev.yaml
#删除
kubectl delete -f ns-dev.yaml

》》》Bloggers update their learning experience for a long time, recommend likes and follow! ! !
》》》If there is something wrong, please leave a message in the comment area, thank you! ! !

Guess you like

Origin blog.csdn.net/qq_41622739/article/details/114171068