Question: What is Parameters?

Answer: n a m e s p a c e   ( i n   p a t h ) :   s t r i n g ,   r e q u i r e d n a m e s p a c e b o d y :   D e l e t e O p t i o n s c o n t i n u e   ( i n   q u e r y ) :   s t r i n g c o n t i n u e d r y R u n   ( i n   q u e r y ) :   s t r i n g d r y R u n f i e l d S e l e c t o r   ( i n   q u e r y ) :   s t r i n g f i e l d S e l e c t o r g r a c e P e r i o d S e c o n d s   ( i n   q u e r y ) :   i n t e g e r g r a c e P e r i o d S e c o n d s i g n o r e S t o r e R e a d E r r o r W i t h C l u s t e r B r e a k i n g P o t e n t i a l   ( i n   q u e r y ) :   b o o l e a n i g n o r e S t o r e R e a d E r r o r W i t h C l u s t e r B r e a k i n g P o t e n t i a l l a b e l S e l e c t o r   ( i n   q u e r y ) :   s t r i n g l a b e l S e l e c t o r l i m i t   ( i n   q u e r y ) :   i n t e g e r l i m i t p r e t t y   ( i n   q u e r y ) :   s t r i n g p r e t t y p r o p a g a t i o n P o l i c y   ( i n   q u e r y ) :   s t r i n g p r o p a g a t i o n P o l i c y r e s o u r c e V e r s i o n   ( i n   q u e r y ) :   s t r i n g r e s o u r c e V e r s i o n r e s o u r c e V e r s i o n M a t c h   ( i n   q u e r y ) :   s t r i n g r e s o u r c e V e r s i o n M a t c h s e n d I n i t i a l E v e n t s   ( i n   q u e r y ) :   b o o l e a n s e n d I n i t i a l E v e n t s t i m e o u t S e c o n d s   ( i n   q u e r y ) :   i n t e g e r t i m e o u t S e c o n d s   n a m e s p a c e   ( i n   p a t h ) :   s t r i n g ,   r e q u i r e d   n a m e s p a c e   b o d y :   D e l e t e O p t i o n s   c o n t i n u e   ( i n   q u e r y ) :   s t r i n g   c o n t i n u e   d r y R u n   ( i n   q u e r y ) :   s t r i n g   d r y R u n   f i e l d S e l e c t o r   ( i n   q u e r y ) :   s t r i n g   f i e l d S e l e c t o r   g r a c e P e r i o d S e c o n d s   ( i n   q u e r y ) :   i n t e g e r   g r a c e P e r i o d S e c o n d s   i g n o r e S t o r e R e a d E r r o r W i t h C l u s t e r B r e a k i n g


Question: What is Response?

Answer: 2 0 0   ( S t a t u s ) :   O K   4 0 1 :   U n a u t h o r i z e d   T h i s   p a g e   i s   a u t o m a t i c a l l y   g e n e r a t e d .   I f   y o u   p l a n   t o   r e p o r t   a n   i s s u e   w i t h   t h i s   p a g e ,   m e n t i o n   t h a t   t h e   p a g e   i s   a u t o - g e n e r a t e d   i n   y o u r   i s s u e   d e s c r i p t i o n .   T h e   f i x   m a y   n e e d   t o   h a p p e n   e l s e w h e r e   i n   t h e   K u b e r n e t e s   p r o j e c t .


Question: What is kubectl config set-context?

Answer: kubectl config set-contextSynopsisSet a context entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] Examples # Set the user field on the gce context entry without touching other values kubectl config set-context gce --user=cluster-admin Options--cluster stringcluster for the context entry in kubeconfig--currentModify the current context-h, --helphelp for set-context--namespace stringnamespace for the context entry in kubeconfig--user stringuser for the context entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version--password stringPassword for basic authentication to the API server--profile string Default: "none"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: "profile.pprof"Name of the file to write the profile to--request-timeout string Default: "0"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: "cadvisor"database name--storage-driver-host string Default: "localhost:8086"database host:port--storage-driver-password string Default: "root"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: "stats"table name--storage-driver-user string Default: "root"database username--tls-server-name stringServer name to use fo


Question: How does kubectl config set-context work?

Answer: kubectl config set-contextSynopsisSet a context entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] Examples # Set the user field on the gce context entry without touching other values kubectl config set-context gce --user=cluster-admin Options--cluster stringcluster for the context entry in kubeconfig--currentModify the current context-h, --helphelp for set-context--namespace stringnamespace for the context entry in kubeconfig--user stringuser for the context entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version--password stringPassword for basic authentication to the API server--profile string Default: "none"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: "profile.pprof"Name of the file to write the profile to--request-timeout string Default: "0"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: "cadvisor"database name--storage-driver-host string Default: "localhost:8086"database host:port--storage-driver-password string Default: "root"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: "stats"table name--storage-driver-user string Default: "root"database username--tls-server-name stringServer name to use fo


Question: When would you use kubectl config set-context?

Answer: kubectl config set-contextSynopsisSet a context entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] Examples # Set the user field on the gce context entry without touching other values kubectl config set-context gce --user=cluster-admin Options--cluster stringcluster for the context entry in kubeconfig--currentModify the current context-h, --helphelp for set-context--namespace stringnamespace for the context entry in kubeconfig--user stringuser for the context entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version--password stringPassword for basic authentication to the API server--profile string Default: "none"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: "profile.pprof"Name of the file to write the profile to--request-timeout string Default: "0"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: "cadvisor"database name--storage-driver-host string Default: "localhost:8086"database host:port--storage-driver-password string Default: "root"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: "stats"table name--storage-driver-user string Default: "root"database username--tls-server-name stringServer name to use fo


Question: What are the benefits of kubectl config set-context?

Answer: kubectl config set-contextSynopsisSet a context entry in kubeconfig.Specifying a name that already exists will merge new fields on top of existing values for those fields.kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace] Examples # Set the user field on the gce context entry without touching other values kubectl config set-context gce --user=cluster-admin Options--cluster stringcluster for the context entry in kubeconfig--currentModify the current context-h, --helphelp for set-context--namespace stringnamespace for the context entry in kubeconfig--user stringuser for the context entry in kubeconfigParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version--password stringPassword for basic authentication to the API server--profile string Default: "none"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: "profile.pprof"Name of the file to write the profile to--request-timeout string Default: "0"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: "cadvisor"database name--storage-driver-host string Default: "localhost:8086"database host:port--storage-driver-password string Default: "root"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: "stats"table name--storage-driver-user string Default: "root"database username--tls-server-name stringServer name to use fo


Question: What is Synopsis?

Answer: S e t   a   c o n t e x t   e n t r y   i n   k u b e c o n f i g .   S p e c i f y i n g   a   n a m e   t h a t   a l r e a d y   e x i s t s   w i l l   m e r g e   n e w   f i e l d s   o n   t o p   o f   e x i s t i n g   v a l u e s   f o r   t h o s e   f i e l d s .   k u b e c t l   c o n f i g   s e t - c o n t e x t   [ N A M E   |   - - c u r r e n t ]   [ - - c l u s t e r = c l u s t e r _ n i c k n a m e ]   [ - - u s e r = u s e r _ n i c k n a m e ]   [ - - n a m e s p a c e = n a m e s p a c e ]


Question: What is Examples?

Answer: #   S e t   t h e   u s e r   f i e l d   o n   t h e   g c e   c o n t e x t   e n t r y   w i t h o u t   t o u c h i n g   o t h e r   v a l u e s   k u b e c t l   c o n f i g   s e t - c o n t e x t   g c e   - - u s e r = c l u s t e r - a d m i n


Question: What is Options?

Answer: c l u s t e r   f o r   t h e   c o n t e x t   e n t r y   i n   k u b e c o n f i g   M o d i f y   t h e   c u r r e n t   c o n t e x t   h e l p   f o r   s e t - c o n t e x t   n a m e s p a c e   f o r   t h e   c o n t e x t   e n t r y   i n   k u b e c o n f i g   u s e r   f o r   t h e   c o n t e x t   e n t r y   i n   k u b e c o n f i g


Question: What is Parent Options Inherited?

Answer: U s e r n a m e   t o   i m p e r s o n a t e   f o r   t h e   o p e r a t i o n .   U s e r   c o u l d   b e   a   r e g u l a r   u s e r   o r   a   s e r v i c e   a c c o u n t   i n   a   n a m e s p a c e .   G r o u p   t o   i m p e r s o n a t e   f o r   t h e   o p e r a t i o n ,   t h i s   f l a g   c a n   b e   r e p e a t e d   t o   s p e c i f y   m u l t i p l e   g r o u p s .   U I D   t o   i m p e r s o n a t e   f o r   t h e   o p e r a t i o n .   D e f a u l t   c a c h e   d i r e c t o r y   P a t h   t o   a   c e r t   f i l e   f o r   t h e   c e r t i f i c a t e   a u t h o r i t y   P a t h   t o   a   c l i e n t   c e r t i f i c a t e   f i l e   f o r   T L S   P a t h   t o   a   c l i e n t   k e y   f i l e   f o r   T L S   T h e   n a m e   o f   t h e   k u b e c o n f i g   c o n t e x t   t o   u s e   I f   t r u e ,   o p t - o u t   o f   r e s p o n s e   c o m p r e s s i o n   f o r   a l l   r e q u e s t s   t o   t h e   s e r v e r   I f   t r u e ,   t h e   s e r v e r ' s   c e r t i f i c a t e   w i l l   n o t   b e   c h e c k e d   f o r   v a l i d i t y .   T h i s   w i l l   m a k e   y o u r   H T T P S   c o n n e c t i o n s   i n s e c u r e   u s e   a   p a r t i c u l a r   k u b e c o n f i g   f i l e   P a t h   t o   t h e   k u b e r c   f i l e   t o   u s e   f o r   p r e f e r e n c e s .   T h i s   c a n   b e   d i s a b l e d   b y   e x p o r t i n g   K U B E C T L _ K U B E R C = f a l s e   f e a t u r e   g a t e   o r   t u r n i n g   o f f   t h e   f e a t u r e   K U B E R C = o f f .   R e q u i r e   s e r v e r   v e r s i o n   t o   m a t c h   c l i e n t   v e r s i o n   P a s s w o r d   f o r   b a s i c   a u t h e n t i c a t i o n   t o   t h e   A P I   s e r v e r   N a m e   o f   p r o f i l e   t o   c a p t u r e .   O n e   o f   ( n o n e | c p u | h e a p | g o r o u t i n e | t h r e a d c r e a t e | b l o c k | m u t e x )   N a m e   o f


Question: What is See Also?

Answer: k u b e c t l   c o n f i g   -   M o d i f y   k u b e c o n f i g   f i l e s   T h i s   p a g e   i s   a u t o m a t i c a l l y   g e n e r a t e d .   I f   y o u   p l a n   t o   r e p o r t   a n   i s s u e   w i t h   t h i s   p a g e ,   m e n t i o n   t h a t   t h e   p a g e   i s   a u t o - g e n e r a t e d   i n   y o u r   i s s u e   d e s c r i p t i o n .   T h e   f i x   m a y   n e e d   t o   h a p p e n   e l s e w h e r e   i n   t h e   K u b e r n e t e s   p r o j e c t .


Question: What is Share a Cluster with Namespaces?

Answer: Share a Cluster with NamespacesThis page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.Before you beginHave an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Viewing namespacesList the current namespaces in a cluster using:kubectl get namespaces NAME STATUS AGE default Active 11d kube-node-lease Active 11d kube-public Active 11d kube-system Active 11d Kubernetes starts with four initial namespaces:default The default namespace for objects with no other namespacekube-node-lease This namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-public This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-system The namespace for objects created by the Kubernetes systemYou can also get the summary of a specific namespace using:kubectl get namespaces <name> Or you can get detailed information with:kubectl describe namespaces <name> Name: default Labels: <none> Annotations: <none> Status: Active No resource quota. Resource Limits Type Resource Min Max Default ---- -------- --- --- --- Container cpu - - 100m Note that these details show both resource quota (if present) as well as resource limit ranges.Resource quota tracks aggregate usage of resources in the Namespace and allows cluster operators to define Hard resource usage limits that a Namespace may consume.A limit range defines min/max constraints on the amount of resources a single entity can consume in a Namespace.See Admission control: Limit RangeA namespace can be in one of two phases:Active the namespace is in useTerminating the namespace is being deleted, and can not be used for new objectsFor more details, see Namespace in the API reference.Creating a new namespaceNote:Avoid creating namespace with prefix kube-, since it is reserved for Kubernetes system namespaces.Create a new YAML file called my-namespace.yaml with the contents:apiVersion: v1 kind: Namespace metadata: name: <insert-namespace-name-here> Then run:kubectl create -f ./my-namespace.yaml Alternatively, you can create namespace using below command:kubectl create namespace <insert-namespace-name-here> The name of your namespace must be a valid DNS label.There's an optional field finalizers, which allows observables to purge resources whenever the namespace is deleted. Keep in mind that if you specify a nonexistent finalizer, the namespace will be created but will get stuck in the Terminating state if the user tries to delete it.More information on finalizers can be found in the namespace design doc.Deleting a names


Question: How does Share a Cluster with Namespaces work?

Answer: Share a Cluster with NamespacesThis page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.Before you beginHave an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Viewing namespacesList the current namespaces in a cluster using:kubectl get namespaces NAME STATUS AGE default Active 11d kube-node-lease Active 11d kube-public Active 11d kube-system Active 11d Kubernetes starts with four initial namespaces:default The default namespace for objects with no other namespacekube-node-lease This namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-public This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-system The namespace for objects created by the Kubernetes systemYou can also get the summary of a specific namespace using:kubectl get namespaces <name> Or you can get detailed information with:kubectl describe namespaces <name> Name: default Labels: <none> Annotations: <none> Status: Active No resource quota. Resource Limits Type Resource Min Max Default ---- -------- --- --- --- Container cpu - - 100m Note that these details show both resource quota (if present) as well as resource limit ranges.Resource quota tracks aggregate usage of resources in the Namespace and allows cluster operators to define Hard resource usage limits that a Namespace may consume.A limit range defines min/max constraints on the amount of resources a single entity can consume in a Namespace.See Admission control: Limit RangeA namespace can be in one of two phases:Active the namespace is in useTerminating the namespace is being deleted, and can not be used for new objectsFor more details, see Namespace in the API reference.Creating a new namespaceNote:Avoid creating namespace with prefix kube-, since it is reserved for Kubernetes system namespaces.Create a new YAML file called my-namespace.yaml with the contents:apiVersion: v1 kind: Namespace metadata: name: <insert-namespace-name-here> Then run:kubectl create -f ./my-namespace.yaml Alternatively, you can create namespace using below command:kubectl create namespace <insert-namespace-name-here> The name of your namespace must be a valid DNS label.There's an optional field finalizers, which allows observables to purge resources whenever the namespace is deleted. Keep in mind that if you specify a nonexistent finalizer, the namespace will be created but will get stuck in the Terminating state if the user tries to delete it.More information on finalizers can be found in the namespace design doc.Deleting a names


Question: When would you use Share a Cluster with Namespaces?

Answer: Share a Cluster with NamespacesThis page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.Before you beginHave an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Viewing namespacesList the current namespaces in a cluster using:kubectl get namespaces NAME STATUS AGE default Active 11d kube-node-lease Active 11d kube-public Active 11d kube-system Active 11d Kubernetes starts with four initial namespaces:default The default namespace for objects with no other namespacekube-node-lease This namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-public This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-system The namespace for objects created by the Kubernetes systemYou can also get the summary of a specific namespace using:kubectl get namespaces <name> Or you can get detailed information with:kubectl describe namespaces <name> Name: default Labels: <none> Annotations: <none> Status: Active No resource quota. Resource Limits Type Resource Min Max Default ---- -------- --- --- --- Container cpu - - 100m Note that these details show both resource quota (if present) as well as resource limit ranges.Resource quota tracks aggregate usage of resources in the Namespace and allows cluster operators to define Hard resource usage limits that a Namespace may consume.A limit range defines min/max constraints on the amount of resources a single entity can consume in a Namespace.See Admission control: Limit RangeA namespace can be in one of two phases:Active the namespace is in useTerminating the namespace is being deleted, and can not be used for new objectsFor more details, see Namespace in the API reference.Creating a new namespaceNote:Avoid creating namespace with prefix kube-, since it is reserved for Kubernetes system namespaces.Create a new YAML file called my-namespace.yaml with the contents:apiVersion: v1 kind: Namespace metadata: name: <insert-namespace-name-here> Then run:kubectl create -f ./my-namespace.yaml Alternatively, you can create namespace using below command:kubectl create namespace <insert-namespace-name-here> The name of your namespace must be a valid DNS label.There's an optional field finalizers, which allows observables to purge resources whenever the namespace is deleted. Keep in mind that if you specify a nonexistent finalizer, the namespace will be created but will get stuck in the Terminating state if the user tries to delete it.More information on finalizers can be found in the namespace design doc.Deleting a names


Question: What are the benefits of Share a Cluster with Namespaces?

Answer: Share a Cluster with NamespacesThis page shows how to view, work in, and delete namespaces. The page also shows how to use Kubernetes namespaces to subdivide your cluster.Before you beginHave an existing Kubernetes cluster.You have a basic understanding of Kubernetes Pods, Services, and Deployments.Viewing namespacesList the current namespaces in a cluster using:kubectl get namespaces NAME STATUS AGE default Active 11d kube-node-lease Active 11d kube-public Active 11d kube-system Active 11d Kubernetes starts with four initial namespaces:default The default namespace for objects with no other namespacekube-node-lease This namespace holds Lease objects associated with each node. Node leases allow the kubelet to send heartbeats so that the control plane can detect node failure.kube-public This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.kube-system The namespace for objects created by the Kubernetes systemYou can also get the summary of a specific namespace using:kubectl get namespaces <name> Or you can get detailed information with:kubectl describe namespaces <name> Name: default Labels: <none> Annotations: <none> Status: Active No resource quota. Resource Limits Type Resource Min Max Default ---- -------- --- --- --- Container cpu - - 100m Note that these details show both resource quota (if present) as well as resource limit ranges.Resource quota tracks aggregate usage of resources in the Namespace and allows cluster operators to define Hard resource usage limits that a Namespace may consume.A limit range defines min/max constraints on the amount of resources a single entity can consume in a Namespace.See Admission control: Limit RangeA namespace can be in one of two phases:Active the namespace is in useTerminating the namespace is being deleted, and can not be used for new objectsFor more details, see Namespace in the API reference.Creating a new namespaceNote:Avoid creating namespace with prefix kube-, since it is reserved for Kubernetes system namespaces.Create a new YAML file called my-namespace.yaml with the contents:apiVersion: v1 kind: Namespace metadata: name: <insert-namespace-name-here> Then run:kubectl create -f ./my-namespace.yaml Alternatively, you can create namespace using below command:kubectl create namespace <insert-namespace-name-here> The name of your namespace must be a valid DNS label.There's an optional field finalizers, which allows observables to purge resources whenever the namespace is deleted. Keep in mind that if you specify a nonexistent finalizer, the namespace will be created but will get stuck in the Terminating state if the user tries to delete it.More information on finalizers can be found in the namespace design doc.Deleting a names


Question: What is Share a Cluster with Namespaces?

Answer: T h i s   p a g e   s h o w s   h o w   t o   v i e w ,   w o r k   i n ,   a n d   d e l e t e   n a m e s p a c e s .   T h e   p a g e   a l s o   s h o w s   h o w   t o   u s e   K u b e r n e t e s   n a m e s p a c e s   t o   s u b d i v i d e   y o u r   c l u s t e r .


Question: What is Before you begin?

Answer: H a v e   a n   e x i s t i n g   K u b e r n e t e s   c l u s t e r . Y o u   h a v e   a   b a s i c   u n d e r s t a n d i n g   o f   K u b e r n e t e s   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s .


Question: What is Viewing namespaces?

Answer: L i s t   t h e   c u r r e n t   n a m e s p a c e s   i n   a   c l u s t e r   u s i n g :   k u b e c t l   g e t   n a m e s p a c e s   N A M E   S T A T U S   A G E   d e f a u l t   A c t i v e   1 1 d   k u b e - n o d e - l e a s e   A c t i v e   1 1 d   k u b e - p u b l i c   A c t i v e   1 1 d   k u b e - s y s t e m   A c t i v e   1 1 d   K u b e r n e t e s   s t a r t s   w i t h   f o u r   i n i t i a l   n a m e s p a c e s :   d e f a u l t   T h e   d e f a u l t   n a m e s p a c e   f o r   o b j e c t s   w i t h   n o   o t h e r   n a m e s p a c e k u b e - n o d e - l e a s e   T h i s   n a m e s p a c e   h o l d s   L e a s e   o b j e c t s   a s s o c i a t e d   w i t h   e a c h   n o d e .   N o d e   l e a s e s   a l l o w   t h e   k u b e l e t   t o   s e n d   h e a r t b e a t s   s o   t h a t   t h e   c o n t r o l   p l a n e   c a n   d e t e c t   n o d e   f a i l u r e . k u b e - p u b l i c   T h i s   n a m e s p a c e   i s   c r e a t e d   a u t o m a t i c a l l y   a n d   i s   r e a d a b l e   b y   a l l   u s e r s   ( i n c l u d i n g   t h o s e   n o t   a u t h e n t i c a t e d ) .   T h i s   n a m e s p a c e   i s   m o s t l y   r e s e r v e d   f o r   c l u s t e r   u s a g e ,   i n   c a s e   t h a t   s o m e   r e s o u r c e s   s h o u l d   b e   v i s i b l e   a n d   r e a d a b l e   p u b l i c l y   t h r o u g h o u t   t h e   w h o l e   c l u s t e r .   T h e   p u b l i c   a s p e c t   o f   t h i s   n a m e s p a c e   i s   o n l y   a   c o n v e n t i o n ,   n o t   a   r e q u i r e m e n t . k u b e - s y s t e m   T h e   n a m e s p a c e   f o r   o b j e c t s   c r e a t e d   b y   t h e   K u b e r n e t e s   s y s t e m   Y o u   c a n   a l s o   g e t   t h e   s u m m a r y   o f   a   s p e c i f i c   n a m e s p a c e   u s i n g :   k u b e c t l   g e t   n a m e s p a c e s   < n a m e >   O r   y o u   c a n   g e t   d e t a i l e d   i


Question: What is Note:?

Answer: C r e a t e   a   n e w   Y A M L   f i l e   c a l l e d   m y - n a m e s p a c e . y a m l   w i t h   t h e   c o n t e n t s :   a p i V e r s i o n :   v 1   k i n d :   N a m e s p a c e   m e t a d a t a :   n a m e :   < i n s e r t - n a m e s p a c e - n a m e - h e r e >   T h e n   r u n :   k u b e c t l   c r e a t e   - f   . / m y - n a m e s p a c e . y a m l   A l t e r n a t i v e l y ,   y o u   c a n   c r e a t e   n a m e s p a c e   u s i n g   b e l o w   c o m m a n d :   k u b e c t l   c r e a t e   n a m e s p a c e   < i n s e r t - n a m e s p a c e - n a m e - h e r e >   T h e   n a m e   o f   y o u r   n a m e s p a c e   m u s t   b e   a   v a l i d   D N S   l a b e l .   T h e r e ' s   a n   o p t i o n a l   f i e l d   f i n a l i z e r s ,   w h i c h   a l l o w s   o b s e r v a b l e s   t o   p u r g e   r e s o u r c e s   w h e n e v e r   t h e   n a m e s p a c e   i s   d e l e t e d .   K e e p   i n   m i n d   t h a t   i f   y o u   s p e c i f y   a   n o n e x i s t e n t   f i n a l i z e r ,   t h e   n a m e s p a c e   w i l l   b e   c r e a t e d   b u t   w i l l   g e t   s t u c k   i n   t h e   T e r m i n a t i n g   s t a t e   i f   t h e   u s e r   t r i e s   t o   d e l e t e   i t .   M o r e   i n f o r m a t i o n   o n   f i n a l i z e r s   c a n   b e   f o u n d   i n   t h e   n a m e s p a c e   d e s i g n   d o c .


Question: What is Deleting a namespace?

Answer: D e l e t e   a   n a m e s p a c e   w i t h   k u b e c t l   d e l e t e   n a m e s p a c e s   < i n s e r t - s o m e - n a m e s p a c e - n a m e >


Question: What is Warning:?

Answer: T h i s   d e l e t e   i s   a s y n c h r o n o u s ,   s o   f o r   a   t i m e   y o u   w i l l   s e e   t h e   n a m e s p a c e   i n   t h e   T e r m i n a t i n g   s t a t e .


Question: What is Subdividing your cluster using Kubernetes namespaces?

Answer: B y   d e f a u l t ,   a   K u b e r n e t e s   c l u s t e r   w i l l   i n s t a n t i a t e   a   d e f a u l t   n a m e s p a c e   w h e n   p r o v i s i o n i n g   t h e   c l u s t e r   t o   h o l d   t h e   d e f a u l t   s e t   o f   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s   u s e d   b y   t h e   c l u s t e r .   A s s u m i n g   y o u   h a v e   a   f r e s h   c l u s t e r ,   y o u   c a n   i n t r o s p e c t   t h e   a v a i l a b l e   n a m e s p a c e s   b y   d o i n g   t h e   f o l l o w i n g :   k u b e c t l   g e t   n a m e s p a c e s   N A M E   S T A T U S   A G E   d e f a u l t   A c t i v e   1 3 m


Question: What is Create new namespaces?

Answer: F o r   t h i s   e x e r c i s e ,   w e   w i l l   c r e a t e   t w o   a d d i t i o n a l   K u b e r n e t e s   n a m e s p a c e s   t o   h o l d   o u r   c o n t e n t .   I n   a   s c e n a r i o   w h e r e   a n   o r g a n i z a t i o n   i s   u s i n g   a   s h a r e d   K u b e r n e t e s   c l u s t e r   f o r   d e v e l o p m e n t   a n d   p r o d u c t i o n   u s e   c a s e s :   T h e   d e v e l o p m e n t   t e a m   w o u l d   l i k e   t o   m a i n t a i n   a   s p a c e   i n   t h e   c l u s t e r   w h e r e   t h e y   c a n   g e t   a   v i e w   o n   t h e   l i s t   o f   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s   t h e y   u s e   t o   b u i l d   a n d   r u n   t h e i r   a p p l i c a t i o n .   I n   t h i s   s p a c e ,   K u b e r n e t e s   r e s o u r c e s   c o m e   a n d   g o ,   a n d   t h e   r e s t r i c t i o n s   o n   w h o   c a n   o r   c a n n o t   m o d i f y   r e s o u r c e s   a r e   r e l a x e d   t o   e n a b l e   a g i l e   d e v e l o p m e n t . T h e   o p e r a t i o n s   t e a m   w o u l d   l i k e   t o   m a i n t a i n   a   s p a c e   i n   t h e   c l u s t e r   w h e r e   t h e y   c a n   e n f o r c e   s t r i c t   p r o c e d u r e s   o n   w h o   c a n   o r   c a n n o t   m a n i p u l a t e   t h e   s e t   o f   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s   t h a t   r u n   t h e   p r o d u c t i o n   s i t e .   T h e   d e v e l o p m e n t   t e a m   w o u l d   l i k e   t o   m a i n t a i n   a   s p a c e   i n   t h e   c l u s t e r   w h e r e   t h e y   c a n   g e t   a   v i e w   o n   t h e   l i s t   o f   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s   t h e y   u s e   t o   b u i l d   a n d   r u n   t h e i r   a p p l i c a t i o n .   I n   t h i s   s p a c e ,   K u b e r n e t e s   r e s o u r c e s   c o m e   a n d   g o ,   a n d   t h e   r e s t r i


Question: What is Create pods in each namespace?

Answer: A   K u b e r n e t e s   n a m e s p a c e   p r o v i d e s   t h e   s c o p e   f o r   P o d s ,   S e r v i c e s ,   a n d   D e p l o y m e n t s   i n   t h e   c l u s t e r .   U s e r s   i n t e r a c t i n g   w i t h   o n e   n a m e s p a c e   d o   n o t   s e e   t h e   c o n t e n t   i n   a n o t h e r   n a m e s p a c e .   T o   d e m o n s t r a t e   t h i s ,   l e t ' s   s p i n   u p   a   s i m p l e   D e p l o y m e n t   a n d   P o d s   i n   t h e   d e v e l o p m e n t   n a m e s p a c e .   k u b e c t l   c r e a t e   d e p l o y m e n t   s n o w f l a k e   \   - - i m a g e = r e g i s t r y . k 8 s . i o / s e r v e _ h o s t n a m e   \   - n = d e v e l o p m e n t   - - r e p l i c a s = 2   W e   h a v e   c r e a t e d   a   d e p l o y m e n t   w h o s e   r e p l i c a   s i z e   i s   2   t h a t   i s   r u n n i n g   t h e   p o d   c a l l e d   s n o w f l a k e   w i t h   a   b a s i c   c o n t a i n e r   t h a t   s e r v e s   t h e   h o s t n a m e .   k u b e c t l   g e t   d e p l o y m e n t   - n = d e v e l o p m e n t   N A M E   R E A D Y   U P - T O - D A T E   A V A I L A B L E   A G E   s n o w f l a k e   2 / 2   2   2   2 m   k u b e c t l   g e t   p o d s   - l   a p p = s n o w f l a k e   - n = d e v e l o p m e n t   N A M E   R E A D Y   S T A T U S   R E S T A R T S   A G E   s n o w f l a k e - 3 9 6 8 8 2 0 9 5 0 - 9 d g r 8   1 / 1   R u n n i n g   0   2 m   s n o w f l a k e - 3 9 6 8 8 2 0 9 5 0 - v g c 4 n   1 / 1   R u n n i n g   0   2 m   A n d   t h i s   i s   g r e a t ,   d e v e l o p e r s   a r e   a b l e   t o   d o   w h a t   t h e y   w a n t ,   a n d   t h e y   d o   n o t   h a v e   t o   w o r r y   a b o u t   a f f e c t i n g   c o n t e n t   i n   t h e   p r o d u c t i o n   n a m e s p a c e .   L e t ' s   s w i t c h   t o   t h e   p r o d u c t i o n   n a m e s p a c e   a n d   s h o w   h o w   r e s o u r c e s   i n   o n e   n a


Question: What is Understanding the motivation for using namespaces?

Answer: A   s i n g l e   c l u s t e r   s h o u l d   b e   a b l e   t o   s a t i s f y   t h e   n e e d s   o f   m u l t i p l e   u s e r s   o r   g r o u p s   o f   u s e r s   ( h e n c e f o r t h   i n   t h i s   d o c u m e n t   a   u s e r   c o m m u n i t y ) .   K u b e r n e t e s   n a m e s p a c e s   h e l p   d i f f e r e n t   p r o j e c t s ,   t e a m s ,   o r   c u s t o m e r s   t o   s h a r e   a   K u b e r n e t e s   c l u s t e r .   I t   d o e s   t h i s   b y   p r o v i d i n g   t h e   f o l l o w i n g :   A   s c o p e   f o r   n a m e s . A   m e c h a n i s m   t o   a t t a c h   a u t h o r i z a t i o n   a n d   p o l i c y   t o   a   s u b s e c t i o n   o f   t h e   c l u s t e r .   U s e   o f   m u l t i p l e   n a m e s p a c e s   i s   o p t i o n a l .   E a c h   u s e r   c o m m u n i t y   w a n t s   t o   b e   a b l e   t o   w o r k   i n   i s o l a t i o n   f r o m   o t h e r   c o m m u n i t i e s .   E a c h   u s e r   c o m m u n i t y   h a s   i t s   o w n :   r e s o u r c e s   ( p o d s ,   s e r v i c e s ,   r e p l i c a t i o n   c o n t r o l l e r s ,   e t c . ) p o l i c i e s   ( w h o   c a n   o r   c a n n o t   p e r f o r m   a c t i o n s   i n   t h e i r   c o m m u n i t y ) c o n s t r a i n t s   ( t h i s   c o m m u n i t y   i s   a l l o w e d   t h i s   m u c h   q u o t a ,   e t c . )   A   c l u s t e r   o p e r a t o r   m a y   c r e a t e   a   N a m e s p a c e   f o r   e a c h   u n i q u e   u s e r   c o m m u n i t y .   T h e   N a m e s p a c e   p r o v i d e s   a   u n i q u e   s c o p e   f o r :   n a m e d   r e s o u r c e s   ( t o   a v o i d   b a s i c   n a m i n g   c o l l i s i o n s ) d e l e g a t e d   m a n a g e m e n t   a u t h o r i t y   t o   t r u s t e d   u s e r s a b i l i t y   t o   l i m i t   c o m m u n i t y   r e s o u r c e   c o n s u m p t i o n   U s e   c a s e s   i n c l u d e :   A s   a   c l u


Question: What is Understanding namespaces and DNS?

Answer: W h e n   y o u   c r e a t e   a   S e r v i c e ,   i t   c r e a t e s   a   c o r r e s p o n d i n g   D N S   e n t r y .   T h i s   e n t r y   i s   o f   t h e   f o r m   < s e r v i c e - n a m e > . < n a m e s p a c e - n a m e > . s v c . c l u s t e r . l o c a l ,   w h i c h   m e a n s   t h a t   i f   a   c o n t a i n e r   u s e s   < s e r v i c e - n a m e >   i t   w i l l   r e s o l v e   t o   t h e   s e r v i c e   w h i c h   i s   l o c a l   t o   a   n a m e s p a c e .   T h i s   i s   u s e f u l   f o r   u s i n g   t h e   s a m e   c o n f i g u r a t i o n   a c r o s s   m u l t i p l e   n a m e s p a c e s   s u c h   a s   D e v e l o p m e n t ,   S t a g i n g   a n d   P r o d u c t i o n .   I f   y o u   w a n t   t o   r e a c h   a c r o s s   n a m e s p a c e s ,   y o u   n e e d   t o   u s e   t h e   f u l l y   q u a l i f i e d   d o m a i n   n a m e   ( F Q D N ) .


Question: What is What's next?

Answer: L e a r n   m o r e   a b o u t   s e t t i n g   t h e   n a m e s p a c e   p r e f e r e n c e . L e a r n   m o r e   a b o u t   s e t t i n g   t h e   n a m e s p a c e   f o r   a   r e q u e s t S e e   n a m e s p a c e s   d e s i g n .


Question: What is Reconfiguring a kubeadm cluster?

Answer: Reconfiguring a kubeadm clusterkubeadm does not support automated ways of reconfiguring components that were deployed on managed nodes. One way of automating this would be by using a custom operator.To modify the components configuration you must manually edit associated cluster objects and files on disk.This guide shows the correct sequence of steps that need to be performed to achieve kubeadm cluster reconfiguration.Before you beginYou need a cluster that was deployed using kubeadmHave administrator credentials (/etc/kubernetes/admin.conf) and network connectivity to a running kube-apiserver in the cluster from a host that has kubectl installedHave a text editor installed on all hostsReconfiguring the clusterkubeadm writes a set of cluster wide component configuration options in ConfigMaps and other objects. These objects must be manually edited. The command kubectl edit can be used for that.The kubectl edit command will open a text editor where you can edit and save the object directly.You can use the environment variables KUBECONFIG and KUBE_EDITOR to specify the location of the kubectl consumed kubeconfig file and preferred text editor.For example:KUBECONFIG=/etc/kubernetes/admin.conf KUBE_EDITOR=nano kubectl edit <parameters> Note:Upon saving any changes to these cluster objects, components running on nodes may not be automatically updated. The steps below instruct you on how to perform that manually.Warning:Component configuration in ConfigMaps is stored as unstructured data (YAML string). This means that validation will not be performed upon updating the contents of a ConfigMap. You have to be careful to follow the documented API format for a particular component configuration and avoid introducing typos and YAML indentation mistakes.Applying cluster configuration changesUpdating the ClusterConfigurationDuring cluster creation and upgrade, kubeadm writes its ClusterConfiguration in a ConfigMap called kubeadm-config in the kube-system namespace.To change a particular option in the ClusterConfiguration you can edit the ConfigMap with this command:kubectl edit cm -n kube-system kubeadm-config The configuration is located under the data.ClusterConfiguration key.Note:The ClusterConfiguration includes a variety of options that affect the configuration of individual components such as kube-apiserver, kube-scheduler, kube-controller-manager, CoreDNS, etcd and kube-proxy. Changes to the configuration must be reflected on node components manually.Reflecting ClusterConfiguration changes on control plane nodeskubeadm manages the control plane components as static Pod manifests located in the directory /etc/kubernetes/manifests. Any changes to the ClusterConfiguration under the apiServer, controllerManager, scheduler or etcd keys must be reflected in the associated files in the manifests directory on a control plane node.Such changes may include:extraArgs - requires updating the list of flags passed to a component containerextraVolumes - requires upda


Question: How does Reconfiguring a kubeadm cluster work?

Answer: Reconfiguring a kubeadm clusterkubeadm does not support automated ways of reconfiguring components that were deployed on managed nodes. One way of automating this would be by using a custom operator.To modify the components configuration you must manually edit associated cluster objects and files on disk.This guide shows the correct sequence of steps that need to be performed to achieve kubeadm cluster reconfiguration.Before you beginYou need a cluster that was deployed using kubeadmHave administrator credentials (/etc/kubernetes/admin.conf) and network connectivity to a running kube-apiserver in the cluster from a host that has kubectl installedHave a text editor installed on all hostsReconfiguring the clusterkubeadm writes a set of cluster wide component configuration options in ConfigMaps and other objects. These objects must be manually edited. The command kubectl edit can be used for that.The kubectl edit command will open a text editor where you can edit and save the object directly.You can use the environment variables KUBECONFIG and KUBE_EDITOR to specify the location of the kubectl consumed kubeconfig file and preferred text editor.For example:KUBECONFIG=/etc/kubernetes/admin.conf KUBE_EDITOR=nano kubectl edit <parameters> Note:Upon saving any changes to these cluster objects, components running on nodes may not be automatically updated. The steps below instruct you on how to perform that manually.Warning:Component configuration in ConfigMaps is stored as unstructured data (YAML string). This means that validation will not be performed upon updating the contents of a ConfigMap. You have to be careful to follow the documented API format for a particular component configuration and avoid introducing typos and YAML indentation mistakes.Applying cluster configuration changesUpdating the ClusterConfigurationDuring cluster creation and upgrade, kubeadm writes its ClusterConfiguration in a ConfigMap called kubeadm-config in the kube-system namespace.To change a particular option in the ClusterConfiguration you can edit the ConfigMap with this command:kubectl edit cm -n kube-system kubeadm-config The configuration is located under the data.ClusterConfiguration key.Note:The ClusterConfiguration includes a variety of options that affect the configuration of individual components such as kube-apiserver, kube-scheduler, kube-controller-manager, CoreDNS, etcd and kube-proxy. Changes to the configuration must be reflected on node components manually.Reflecting ClusterConfiguration changes on control plane nodeskubeadm manages the control plane components as static Pod manifests located in the directory /etc/kubernetes/manifests. Any changes to the ClusterConfiguration under the apiServer, controllerManager, scheduler or etcd keys must be reflected in the associated files in the manifests directory on a control plane node.Such changes may include:extraArgs - requires updating the list of flags passed to a component containerextraVolumes - requires upda


Question: When would you use Reconfiguring a kubeadm cluster?

Answer: Reconfiguring a kubeadm clusterkubeadm does not support automated ways of reconfiguring components that were deployed on managed nodes. One way of automating this would be by using a custom operator.To modify the components configuration you must manually edit associated cluster objects and files on disk.This guide shows the correct sequence of steps that need to be performed to achieve kubeadm cluster reconfiguration.Before you beginYou need a cluster that was deployed using kubeadmHave administrator credentials (/etc/kubernetes/admin.conf) and network connectivity to a running kube-apiserver in the cluster from a host that has kubectl installedHave a text editor installed on all hostsReconfiguring the clusterkubeadm writes a set of cluster wide component configuration options in ConfigMaps and other objects. These objects must be manually edited. The command kubectl edit can be used for that.The kubectl edit command will open a text editor where you can edit and save the object directly.You can use the environment variables KUBECONFIG and KUBE_EDITOR to specify the location of the kubectl consumed kubeconfig file and preferred text editor.For example:KUBECONFIG=/etc/kubernetes/admin.conf KUBE_EDITOR=nano kubectl edit <parameters> Note:Upon saving any changes to these cluster objects, components running on nodes may not be automatically updated. The steps below instruct you on how to perform that manually.Warning:Component configuration in ConfigMaps is stored as unstructured data (YAML string). This means that validation will not be performed upon updating the contents of a ConfigMap. You have to be careful to follow the documented API format for a particular component configuration and avoid introducing typos and YAML indentation mistakes.Applying cluster configuration changesUpdating the ClusterConfigurationDuring cluster creation and upgrade, kubeadm writes its ClusterConfiguration in a ConfigMap called kubeadm-config in the kube-system namespace.To change a particular option in the ClusterConfiguration you can edit the ConfigMap with this command:kubectl edit cm -n kube-system kubeadm-config The configuration is located under the data.ClusterConfiguration key.Note:The ClusterConfiguration includes a variety of options that affect the configuration of individual components such as kube-apiserver, kube-scheduler, kube-controller-manager, CoreDNS, etcd and kube-proxy. Changes to the configuration must be reflected on node components manually.Reflecting ClusterConfiguration changes on control plane nodeskubeadm manages the control plane components as static Pod manifests located in the directory /etc/kubernetes/manifests. Any changes to the ClusterConfiguration under the apiServer, controllerManager, scheduler or etcd keys must be reflected in the associated files in the manifests directory on a control plane node.Such changes may include:extraArgs - requires updating the list of flags passed to a component containerextraVolumes - requires upda


Question: What are the benefits of Reconfiguring a kubeadm cluster?

Answer: Reconfiguring a kubeadm clusterkubeadm does not support automated ways of reconfiguring components that were deployed on managed nodes. One way of automating this would be by using a custom operator.To modify the components configuration you must manually edit associated cluster objects and files on disk.This guide shows the correct sequence of steps that need to be performed to achieve kubeadm cluster reconfiguration.Before you beginYou need a cluster that was deployed using kubeadmHave administrator credentials (/etc/kubernetes/admin.conf) and network connectivity to a running kube-apiserver in the cluster from a host that has kubectl installedHave a text editor installed on all hostsReconfiguring the clusterkubeadm writes a set of cluster wide component configuration options in ConfigMaps and other objects. These objects must be manually edited. The command kubectl edit can be used for that.The kubectl edit command will open a text editor where you can edit and save the object directly.You can use the environment variables KUBECONFIG and KUBE_EDITOR to specify the location of the kubectl consumed kubeconfig file and preferred text editor.For example:KUBECONFIG=/etc/kubernetes/admin.conf KUBE_EDITOR=nano kubectl edit <parameters> Note:Upon saving any changes to these cluster objects, components running on nodes may not be automatically updated. The steps below instruct you on how to perform that manually.Warning:Component configuration in ConfigMaps is stored as unstructured data (YAML string). This means that validation will not be performed upon updating the contents of a ConfigMap. You have to be careful to follow the documented API format for a particular component configuration and avoid introducing typos and YAML indentation mistakes.Applying cluster configuration changesUpdating the ClusterConfigurationDuring cluster creation and upgrade, kubeadm writes its ClusterConfiguration in a ConfigMap called kubeadm-config in the kube-system namespace.To change a particular option in the ClusterConfiguration you can edit the ConfigMap with this command:kubectl edit cm -n kube-system kubeadm-config The configuration is located under the data.ClusterConfiguration key.Note:The ClusterConfiguration includes a variety of options that affect the configuration of individual components such as kube-apiserver, kube-scheduler, kube-controller-manager, CoreDNS, etcd and kube-proxy. Changes to the configuration must be reflected on node components manually.Reflecting ClusterConfiguration changes on control plane nodeskubeadm manages the control plane components as static Pod manifests located in the directory /etc/kubernetes/manifests. Any changes to the ClusterConfiguration under the apiServer, controllerManager, scheduler or etcd keys must be reflected in the associated files in the manifests directory on a control plane node.Such changes may include:extraArgs - requires updating the list of flags passed to a component containerextraVolumes - requires upda


Question: What is Reconfiguring a kubeadm cluster?

Answer: k u b e a d m   d o e s   n o t   s u p p o r t   a u t o m a t e d   w a y s   o f   r e c o n f i g u r i n g   c o m p o n e n t s   t h a t   w e r e   d e p l o y e d   o n   m a n a g e d   n o d e s .   O n e   w a y   o f   a u t o m a t i n g   t h i s   w o u l d   b e   b y   u s i n g   a   c u s t o m   o p e r a t o r .   T o   m o d i f y   t h e   c o m p o n e n t s   c o n f i g u r a t i o n   y o u   m u s t   m a n u a l l y   e d i t   a s s o c i a t e d   c l u s t e r   o b j e c t s   a n d   f i l e s   o n   d i s k .   T h i s   g u i d e   s h o w s   t h e   c o r r e c t   s e q u e n c e   o f   s t e p s   t h a t   n e e d   t o   b e   p e r f o r m e d   t o   a c h i e v e   k u b e a d m   c l u s t e r   r e c o n f i g u r a t i o n .


Question: What is Before you begin?

Answer: Y o u   n e e d   a   c l u s t e r   t h a t   w a s   d e p l o y e d   u s i n g   k u b e a d m H a v e   a d m i n i s t r a t o r   c r e d e n t i a l s   ( / e t c / k u b e r n e t e s / a d m i n . c o n f )   a n d   n e t w o r k   c o n n e c t i v i t y   t o   a   r u n n i n g   k u b e - a p i s e r v e r   i n   t h e   c l u s t e r   f r o m   a   h o s t   t h a t   h a s   k u b e c t l   i n s t a l l e d H a v e   a   t e x t   e d i t o r   i n s t a l l e d   o n   a l l   h o s t s


Question: What is Reconfiguring the cluster?

Answer: k u b e a d m   w r i t e s   a   s e t   o f   c l u s t e r   w i d e   c o m p o n e n t   c o n f i g u r a t i o n   o p t i o n s   i n   C o n f i g M a p s   a n d   o t h e r   o b j e c t s .   T h e s e   o b j e c t s   m u s t   b e   m a n u a l l y   e d i t e d .   T h e   c o m m a n d   k u b e c t l   e d i t   c a n   b e   u s e d   f o r   t h a t .   T h e   k u b e c t l   e d i t   c o m m a n d   w i l l   o p e n   a   t e x t   e d i t o r   w h e r e   y o u   c a n   e d i t   a n d   s a v e   t h e   o b j e c t   d i r e c t l y .   Y o u   c a n   u s e   t h e   e n v i r o n m e n t   v a r i a b l e s   K U B E C O N F I G   a n d   K U B E _ E D I T O R   t o   s p e c i f y   t h e   l o c a t i o n   o f   t h e   k u b e c t l   c o n s u m e d   k u b e c o n f i g   f i l e   a n d   p r e f e r r e d   t e x t   e d i t o r .   F o r   e x a m p l e :   K U B E C O N F I G = / e t c / k u b e r n e t e s / a d m i n . c o n f   K U B E _ E D I T O R = n a n o   k u b e c t l   e d i t   < p a r a m e t e r s >


Question: What is Updating the ClusterConfiguration?

Answer: D u r i n g   c l u s t e r   c r e a t i o n   a n d   u p g r a d e ,   k u b e a d m   w r i t e s   i t s   C l u s t e r C o n f i g u r a t i o n   i n   a   C o n f i g M a p   c a l l e d   k u b e a d m - c o n f i g   i n   t h e   k u b e - s y s t e m   n a m e s p a c e .   T o   c h a n g e   a   p a r t i c u l a r   o p t i o n   i n   t h e   C l u s t e r C o n f i g u r a t i o n   y o u   c a n   e d i t   t h e   C o n f i g M a p   w i t h   t h i s   c o m m a n d :   k u b e c t l   e d i t   c m   - n   k u b e - s y s t e m   k u b e a d m - c o n f i g   T h e   c o n f i g u r a t i o n   i s   l o c a t e d   u n d e r   t h e   d a t a . C l u s t e r C o n f i g u r a t i o n   k e y .


Question: What is Reflecting ClusterConfiguration changes on control plane nodes?

Answer: k u b e a d m   m a n a g e s   t h e   c o n t r o l   p l a n e   c o m p o n e n t s   a s   s t a t i c   P o d   m a n i f e s t s   l o c a t e d   i n   t h e   d i r e c t o r y   / e t c / k u b e r n e t e s / m a n i f e s t s .   A n y   c h a n g e s   t o   t h e   C l u s t e r C o n f i g u r a t i o n   u n d e r   t h e   a p i S e r v e r ,   c o n t r o l l e r M a n a g e r ,   s c h e d u l e r   o r   e t c d   k e y s   m u s t   b e   r e f l e c t e d   i n   t h e   a s s o c i a t e d   f i l e s   i n   t h e   m a n i f e s t s   d i r e c t o r y   o n   a   c o n t r o l   p l a n e   n o d e .   S u c h   c h a n g e s   m a y   i n c l u d e :   e x t r a A r g s   -   r e q u i r e s   u p d a t i n g   t h e   l i s t   o f   f l a g s   p a s s e d   t o   a   c o m p o n e n t   c o n t a i n e r e x t r a V o l u m e s   -   r e q u i r e s   u p d a t i n g   t h e   v o l u m e   m o u n t s   f o r   a   c o m p o n e n t   c o n t a i n e r * S A N s   -   r e q u i r e s   w r i t i n g   n e w   c e r t i f i c a t e s   w i t h   u p d a t e d   S u b j e c t   A l t e r n a t i v e   N a m e s   B e f o r e   p r o c e e d i n g   w i t h   t h e s e   c h a n g e s ,   m a k e   s u r e   y o u   h a v e   b a c k e d   u p   t h e   d i r e c t o r y   / e t c / k u b e r n e t e s / .   T o   w r i t e   n e w   c e r t i f i c a t e s   y o u   c a n   u s e :   k u b e a d m   i n i t   p h a s e   c e r t s   < c o m p o n e n t - n a m e >   - - c o n f i g   < c o n f i g - f i l e >   T o   w r i t e   n e w   m a n i f e s t   f i l e s   i n   / e t c / k u b e r n e t e s / m a n i f e s t s   y o u   c a n   u s e :   #   F o r   K u b e r n e t e s   c o n t r o l   p l a n e   c o m p o n e n t s   k u b e a d m   i n i t   p h a s e   c o n t r o l - p l a n e   < c o m p o n e n t - n a m e >   - - c o n f i g   < c o n f i g - f i l e >   #   F o r   l o c a l   e t c d   k u b e a d m   i n i t   p h


Question: What is Updating the KubeletConfiguration?

Answer: D u r i n g   c l u s t e r   c r e a t i o n   a n d   u p g r a d e ,   k u b e a d m   w r i t e s   i t s   K u b e l e t C o n f i g u r a t i o n   i n   a   C o n f i g M a p   c a l l e d   k u b e l e t - c o n f i g   i n   t h e   k u b e - s y s t e m   n a m e s p a c e .   Y o u   c a n   e d i t   t h e   C o n f i g M a p   w i t h   t h i s   c o m m a n d :   k u b e c t l   e d i t   c m   - n   k u b e - s y s t e m   k u b e l e t - c o n f i g   T h e   c o n f i g u r a t i o n   i s   l o c a t e d   u n d e r   t h e   d a t a . k u b e l e t   k e y .


Question: What is Reflecting the kubelet changes?

Answer: T o   r e f l e c t   t h e   c h a n g e   o n   k u b e a d m   n o d e s   y o u   m u s t   d o   t h e   f o l l o w i n g :   L o g   i n   t o   a   k u b e a d m   n o d e R u n   k u b e a d m   u p g r a d e   n o d e   p h a s e   k u b e l e t - c o n f i g   t o   d o w n l o a d   t h e   l a t e s t   k u b e l e t - c o n f i g   C o n f i g M a p   c o n t e n t s   i n t o   t h e   l o c a l   f i l e   / v a r / l i b / k u b e l e t / c o n f i g . y a m l E d i t   t h e   f i l e   / v a r / l i b / k u b e l e t / k u b e a d m - f l a g s . e n v   t o   a p p l y   a d d i t i o n a l   c o n f i g u r a t i o n   w i t h   f l a g s R e s t a r t   t h e   k u b e l e t   s e r v i c e   w i t h   s y s t e m c t l   r e s t a r t   k u b e l e t


Question: What is Updating the KubeProxyConfiguration?

Answer: D u r i n g   c l u s t e r   c r e a t i o n   a n d   u p g r a d e ,   k u b e a d m   w r i t e s   i t s   K u b e P r o x y C o n f i g u r a t i o n   i n   a   C o n f i g M a p   i n   t h e   k u b e - s y s t e m   n a m e s p a c e   c a l l e d   k u b e - p r o x y .   T h i s   C o n f i g M a p   i s   u s e d   b y   t h e   k u b e - p r o x y   D a e m o n S e t   i n   t h e   k u b e - s y s t e m   n a m e s p a c e .   T o   c h a n g e   a   p a r t i c u l a r   o p t i o n   i n   t h e   K u b e P r o x y C o n f i g u r a t i o n ,   y o u   c a n   e d i t   t h e   C o n f i g M a p   w i t h   t h i s   c o m m a n d :   k u b e c t l   e d i t   c m   - n   k u b e - s y s t e m   k u b e - p r o x y   T h e   c o n f i g u r a t i o n   i s   l o c a t e d   u n d e r   t h e   d a t a . c o n f i g . c o n f   k e y .


Question: What is Reflecting the kube-proxy changes?

Answer: O n c e   t h e   k u b e - p r o x y   C o n f i g M a p   i s   u p d a t e d ,   y o u   c a n   r e s t a r t   a l l   k u b e - p r o x y   P o d s :   D e l e t e   t h e   P o d s   w i t h :   k u b e c t l   d e l e t e   p o   - n   k u b e - s y s t e m   - l   k 8 s - a p p = k u b e - p r o x y   N e w   P o d s   t h a t   u s e   t h e   u p d a t e d   C o n f i g M a p   w i l l   b e   c r e a t e d .


Question: What is Updating the CoreDNS Deployment and Service?

Answer: k u b e a d m   d e p l o y s   C o r e D N S   a s   a   D e p l o y m e n t   c a l l e d   c o r e d n s   a n d   w i t h   a   S e r v i c e   k u b e - d n s ,   b o t h   i n   t h e   k u b e - s y s t e m   n a m e s p a c e .   T o   u p d a t e   a n y   o f   t h e   C o r e D N S   s e t t i n g s ,   y o u   c a n   e d i t   t h e   D e p l o y m e n t   a n d   S e r v i c e   o b j e c t s :   k u b e c t l   e d i t   d e p l o y m e n t   - n   k u b e - s y s t e m   c o r e d n s   k u b e c t l   e d i t   s e r v i c e   - n   k u b e - s y s t e m   k u b e - d n s


Question: What is Reflecting the CoreDNS changes?

Answer: O n c e   t h e   C o r e D N S   c h a n g e s   a r e   a p p l i e d   y o u   c a n   r e s t a r t   t h e   C o r e D N S   d e p l o y m e n t :   k u b e c t l   r o l l o u t   r e s t a r t   d e p l o y m e n t   - n   k u b e - s y s t e m   c o r e d n s


Question: What is Persisting the reconfiguration?

Answer: D u r i n g   t h e   e x e c u t i o n   o f   k u b e a d m   u p g r a d e   o n   a   m a n a g e d   n o d e ,   k u b e a d m   m i g h t   o v e r w r i t e   c o n f i g u r a t i o n   t h a t   w a s   a p p l i e d   a f t e r   t h e   c l u s t e r   w a s   c r e a t e d   ( r e c o n f i g u r a t i o n ) .


Question: What is Persisting Node object reconfiguration?

Answer: k u b e a d m   w r i t e s   L a b e l s ,   T a i n t s ,   C R I   s o c k e t   a n d   o t h e r   i n f o r m a t i o n   o n   t h e   N o d e   o b j e c t   f o r   a   p a r t i c u l a r   K u b e r n e t e s   n o d e .   T o   c h a n g e   a n y   o f   t h e   c o n t e n t s   o f   t h i s   N o d e   o b j e c t   y o u   c a n   u s e :   k u b e c t l   e d i t   n o   < n o d e - n a m e >   D u r i n g   k u b e a d m   u p g r a d e   t h e   c o n t e n t s   o f   s u c h   a   N o d e   m i g h t   g e t   o v e r w r i t t e n .   I f   y o u   w o u l d   l i k e   t o   p e r s i s t   y o u r   m o d i f i c a t i o n s   t o   t h e   N o d e   o b j e c t   a f t e r   u p g r a d e ,   y o u   c a n   p r e p a r e   a   k u b e c t l   p a t c h   a n d   a p p l y   i t   t o   t h e   N o d e   o b j e c t :   k u b e c t l   p a t c h   n o   < n o d e - n a m e >   - - p a t c h - f i l e   < p a t c h - f i l e >


Question: What is Persisting control plane component reconfiguration?

Answer: T h e   m a i n   s o u r c e   o f   c o n t r o l   p l a n e   c o n f i g u r a t i o n   i s   t h e   C l u s t e r C o n f i g u r a t i o n   o b j e c t   s t o r e d   i n   t h e   c l u s t e r .   T o   e x t e n d   t h e   s t a t i c   P o d   m a n i f e s t s   c o n f i g u r a t i o n ,   p a t c h e s   c a n   b e   u s e d .   T h e s e   p a t c h   f i l e s   m u s t   r e m a i n   a s   f i l e s   o n   t h e   c o n t r o l   p l a n e   n o d e s   t o   e n s u r e   t h a t   t h e y   c a n   b e   u s e d   b y   t h e   k u b e a d m   u p g r a d e   . . .   - - p a t c h e s   < d i r e c t o r y > .   I f   r e c o n f i g u r a t i o n   i s   d o n e   t o   t h e   C l u s t e r C o n f i g u r a t i o n   a n d   s t a t i c   P o d   m a n i f e s t s   o n   d i s k ,   t h e   s e t   o f   n o d e   s p e c i f i c   p a t c h e s   m u s t   b e   u p d a t e d   a c c o r d i n g l y .


Question: What is Persisting kubelet reconfiguration?

Answer: A n y   c h a n g e s   t o   t h e   K u b e l e t C o n f i g u r a t i o n   s t o r e d   i n   / v a r / l i b / k u b e l e t / c o n f i g . y a m l   w i l l   b e   o v e r w r i t t e n   o n   k u b e a d m   u p g r a d e   b y   d o w n l o a d i n g   t h e   c o n t e n t s   o f   t h e   c l u s t e r   w i d e   k u b e l e t - c o n f i g   C o n f i g M a p .   T o   p e r s i s t   k u b e l e t   n o d e   s p e c i f i c   c o n f i g u r a t i o n   e i t h e r   t h e   f i l e   / v a r / l i b / k u b e l e t / c o n f i g . y a m l   h a s   t o   b e   u p d a t e d   m a n u a l l y   p o s t - u p g r a d e   o r   t h e   f i l e   / v a r / l i b / k u b e l e t / k u b e a d m - f l a g s . e n v   c a n   i n c l u d e   f l a g s .   T h e   k u b e l e t   f l a g s   o v e r r i d e   t h e   a s s o c i a t e d   K u b e l e t C o n f i g u r a t i o n   o p t i o n s ,   b u t   n o t e   t h a t   s o m e   o f   t h e   f l a g s   a r e   d e p r e c a t e d .   A   k u b e l e t   r e s t a r t   w i l l   b e   r e q u i r e d   a f t e r   c h a n g i n g   / v a r / l i b / k u b e l e t / c o n f i g . y a m l   o r   / v a r / l i b / k u b e l e t / k u b e a d m - f l a g s . e n v .


Question: What is What's next?

Answer: U p g r a d i n g   k u b e a d m   c l u s t e r s C u s t o m i z i n g   c o m p o n e n t s   w i t h   t h e   k u b e a d m   A P I C e r t i f i c a t e   m a n a g e m e n t   w i t h   k u b e a d m F i n d   m o r e   a b o u t   k u b e a d m   s e t - u p


Question: What is Configure Default Memory Requests and Limits for a Namespace?

Answer: Configure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.This page shows how to configure default memory requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. Once you have a namespace that has a default memory limit, and you then try to create a Pod with a container that does not specify its own memory limit, then the control plane assigns the default memory limit to that container.Kubernetes assigns a default memory request under certain conditions that are explained later in this topic.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 2 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-mem-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.admin/resource/memory-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-limit-range spec: limits: - default: memory: 512Mi defaultRequest: memory: 256Mi type: Container Create the LimitRange in the default-mem-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies default values: a memory request of 256MiB and a memory limit of 512MiB.Here's an example manifest for a Pod that has one container. The container does not specify a memory request and limit.admin/resource/memory-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo spec: containers: - name: default-mem-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 512Mi requests: memory: 256Mi Delete yo


Question: How does Configure Default Memory Requests and Limits for a Namespace work?

Answer: Configure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.This page shows how to configure default memory requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. Once you have a namespace that has a default memory limit, and you then try to create a Pod with a container that does not specify its own memory limit, then the control plane assigns the default memory limit to that container.Kubernetes assigns a default memory request under certain conditions that are explained later in this topic.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 2 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-mem-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.admin/resource/memory-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-limit-range spec: limits: - default: memory: 512Mi defaultRequest: memory: 256Mi type: Container Create the LimitRange in the default-mem-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies default values: a memory request of 256MiB and a memory limit of 512MiB.Here's an example manifest for a Pod that has one container. The container does not specify a memory request and limit.admin/resource/memory-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo spec: containers: - name: default-mem-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 512Mi requests: memory: 256Mi Delete yo


Question: When would you use Configure Default Memory Requests and Limits for a Namespace?

Answer: Configure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.This page shows how to configure default memory requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. Once you have a namespace that has a default memory limit, and you then try to create a Pod with a container that does not specify its own memory limit, then the control plane assigns the default memory limit to that container.Kubernetes assigns a default memory request under certain conditions that are explained later in this topic.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 2 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-mem-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.admin/resource/memory-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-limit-range spec: limits: - default: memory: 512Mi defaultRequest: memory: 256Mi type: Container Create the LimitRange in the default-mem-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies default values: a memory request of 256MiB and a memory limit of 512MiB.Here's an example manifest for a Pod that has one container. The container does not specify a memory request and limit.admin/resource/memory-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo spec: containers: - name: default-mem-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 512Mi requests: memory: 256Mi Delete yo


Question: What are the benefits of Configure Default Memory Requests and Limits for a Namespace?

Answer: Configure Default Memory Requests and Limits for a NamespaceDefine a default memory resource limit for a namespace, so that every new Pod in that namespace has a memory resource limit configured.This page shows how to configure default memory requests and limits for a namespace.A Kubernetes cluster can be divided into namespaces. Once you have a namespace that has a default memory limit, and you then try to create a Pod with a container that does not specify its own memory limit, then the control plane assigns the default memory limit to that container.Kubernetes assigns a default memory request under certain conditions that are explained later in this topic.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 2 GiB of memory.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace default-mem-example Create a LimitRange and a PodHere's a manifest for an example LimitRange. The manifest specifies a default memory request and a default memory limit.admin/resource/memory-defaults.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-limit-range spec: limits: - default: memory: 512Mi defaultRequest: memory: 256Mi type: Container Create the LimitRange in the default-mem-example namespace:kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults.yaml --namespace=default-mem-example Now if you create a Pod in the default-mem-example namespace, and any container within that Pod does not specify its own values for memory request and memory limit, then the control plane applies default values: a memory request of 256MiB and a memory limit of 512MiB.Here's an example manifest for a Pod that has one container. The container does not specify a memory request and limit.admin/resource/memory-defaults-pod.yaml apiVersion: v1 kind: Pod metadata: name: default-mem-demo spec: containers: - name: default-mem-demo-ctr image: nginx Create the Pod.kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod.yaml --namespace=default-mem-example View detailed information about the Pod:kubectl get pod default-mem-demo --output=yaml --namespace=default-mem-example The output shows that the Pod's container has a memory request of 256 MiB and a memory limit of 512 MiB. These are the default values specified by the LimitRange.containers: - image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 512Mi requests: memory: 256Mi Delete yo


Question: What is Configure Default Memory Requests and Limits for a Namespace?

Answer: T h i s   p a g e   s h o w s   h o w   t o   c o n f i g u r e   d e f a u l t   m e m o r y   r e q u e s t s   a n d   l i m i t s   f o r   a   n a m e s p a c e .   A   K u b e r n e t e s   c l u s t e r   c a n   b e   d i v i d e d   i n t o   n a m e s p a c e s .   O n c e   y o u   h a v e   a   n a m e s p a c e   t h a t   h a s   a   d e f a u l t   m e m o r y   l i m i t ,   a n d   y o u   t h e n   t r y   t o   c r e a t e   a   P o d   w i t h   a   c o n t a i n e r   t h a t   d o e s   n o t   s p e c i f y   i t s   o w n   m e m o r y   l i m i t ,   t h e n   t h e   c o n t r o l   p l a n e   a s s i g n s   t h e   d e f a u l t   m e m o r y   l i m i t   t o   t h a t   c o n t a i n e r .   K u b e r n e t e s   a s s i g n s   a   d e f a u l t   m e m o r y   r e q u e s t   u n d e r   c e r t a i n   c o n d i t i o n s   t h a t   a r e   e x p l a i n e d   l a t e r   i n   t h i s   t o p i c .


Question: What is Before you begin?

Answer: Y o u   n e e d   t o   h a v e   a   K u b e r n e t e s   c l u s t e r ,   a n d   t h e   k u b e c t l   c o m m a n d - l i n e   t o o l   m u s t   b e   c o n f i g u r e d   t o   c o m m u n i c a t e   w i t h   y o u r   c l u s t e r .   I t   i s   r e c o m m e n d e d   t o   r u n   t h i s   t u t o r i a l   o n   a   c l u s t e r   w i t h   a t   l e a s t   t w o   n o d e s   t h a t   a r e   n o t   a c t i n g   a s   c o n t r o l   p l a n e   h o s t s .   I f   y o u   d o   n o t   a l r e a d y   h a v e   a   c l u s t e r ,   y o u   c a n   c r e a t e   o n e   b y   u s i n g   m i n i k u b e   o r   y o u   c a n   u s e   o n e   o f   t h e s e   K u b e r n e t e s   p l a y g r o u n d s :   i x i m i u z   L a b s K i l l e r c o d a K o d e K l o u d P l a y   w i t h   K u b e r n e t e s   Y o u   m u s t   h a v e   a c c e s s   t o   c r e a t e   n a m e s p a c e s   i n   y o u r   c l u s t e r .   E a c h   n o d e   i n   y o u r   c l u s t e r   m u s t   h a v e   a t   l e a s t   2   G i B   o f   m e m o r y .


Question: What is Create a namespace?

Answer: C r e a t e   a   n a m e s p a c e   s o   t h a t   t h e   r e s o u r c e s   y o u   c r e a t e   i n   t h i s   e x e r c i s e   a r e   i s o l a t e d   f r o m   t h e   r e s t   o f   y o u r   c l u s t e r .   k u b e c t l   c r e a t e   n a m e s p a c e   d e f a u l t - m e m - e x a m p l e


Question: What is Create a LimitRange and a Pod?

Answer: H e r e ' s   a   m a n i f e s t   f o r   a n   e x a m p l e   L i m i t R a n g e .   T h e   m a n i f e s t   s p e c i f i e s   a   d e f a u l t   m e m o r y   r e q u e s t   a n d   a   d e f a u l t   m e m o r y   l i m i t .   a p i V e r s i o n :   v 1   k i n d :   L i m i t R a n g e   m e t a d a t a :   n a m e :   m e m - l i m i t - r a n g e   s p e c :   l i m i t s :   -   d e f a u l t :   m e m o r y :   5 1 2 M i   d e f a u l t R e q u e s t :   m e m o r y :   2 5 6 M i   t y p e :   C o n t a i n e r   C r e a t e   t h e   L i m i t R a n g e   i n   t h e   d e f a u l t - m e m - e x a m p l e   n a m e s p a c e :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - d e f a u l t s . y a m l   - - n a m e s p a c e = d e f a u l t - m e m - e x a m p l e   N o w   i f   y o u   c r e a t e   a   P o d   i n   t h e   d e f a u l t - m e m - e x a m p l e   n a m e s p a c e ,   a n d   a n y   c o n t a i n e r   w i t h i n   t h a t   P o d   d o e s   n o t   s p e c i f y   i t s   o w n   v a l u e s   f o r   m e m o r y   r e q u e s t   a n d   m e m o r y   l i m i t ,   t h e n   t h e   c o n t r o l   p l a n e   a p p l i e s   d e f a u l t   v a l u e s :   a   m e m o r y   r e q u e s t   o f   2 5 6 M i B   a n d   a   m e m o r y   l i m i t   o f   5 1 2 M i B .   H e r e ' s   a n   e x a m p l e   m a n i f e s t   f o r   a   P o d   t h a t   h a s   o n e   c o n t a i n e r .   T h e   c o n t a i n e r   d o e s   n o t   s p e c i f y   a   m e m o r y   r e q u e s t   a n d   l i m i t .   a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   d e f a u l t - m e m - d e m o   s p e c :   c o n t a i n e r s :   -   n a m e :   d e f a u l t - m e m - d e m o - c t r   i m a g e :   n g i n x   C r e a t e   t h e   P o d .   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l


Question: What is What if you specify a container's limit, but not its request??

Answer: H e r e ' s   a   m a n i f e s t   f o r   a   P o d   t h a t   h a s   o n e   c o n t a i n e r .   T h e   c o n t a i n e r   s p e c i f i e s   a   m e m o r y   l i m i t ,   b u t   n o t   a   r e q u e s t :   a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   d e f a u l t - m e m - d e m o - 2   s p e c :   c o n t a i n e r s :   -   n a m e :   d e f a u l t - m e m - d e m o - 2 - c t r   i m a g e :   n g i n x   r e s o u r c e s :   l i m i t s :   m e m o r y :   " 1 G i "   C r e a t e   t h e   P o d :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - d e f a u l t s - p o d - 2 . y a m l   - - n a m e s p a c e = d e f a u l t - m e m - e x a m p l e   V i e w   d e t a i l e d   i n f o r m a t i o n   a b o u t   t h e   P o d :   k u b e c t l   g e t   p o d   d e f a u l t - m e m - d e m o - 2   - - o u t p u t = y a m l   - - n a m e s p a c e = d e f a u l t - m e m - e x a m p l e   T h e   o u t p u t   s h o w s   t h a t   t h e   c o n t a i n e r ' s   m e m o r y   r e q u e s t   i s   s e t   t o   m a t c h   i t s   m e m o r y   l i m i t .   N o t i c e   t h a t   t h e   c o n t a i n e r   w a s   n o t   a s s i g n e d   t h e   d e f a u l t   m e m o r y   r e q u e s t   v a l u e   o f   2 5 6 M i .   r e s o u r c e s :   l i m i t s :   m e m o r y :   1 G i   r e q u e s t s :   m e m o r y :   1 G i


Question: What is What if you specify a container's request, but not its limit??

Answer: H e r e ' s   a   m a n i f e s t   f o r   a   P o d   t h a t   h a s   o n e   c o n t a i n e r .   T h e   c o n t a i n e r   s p e c i f i e s   a   m e m o r y   r e q u e s t ,   b u t   n o t   a   l i m i t :   a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   d e f a u l t - m e m - d e m o - 3   s p e c :   c o n t a i n e r s :   -   n a m e :   d e f a u l t - m e m - d e m o - 3 - c t r   i m a g e :   n g i n x   r e s o u r c e s :   r e q u e s t s :   m e m o r y :   " 1 2 8 M i "   C r e a t e   t h e   P o d :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - d e f a u l t s - p o d - 3 . y a m l   - - n a m e s p a c e = d e f a u l t - m e m - e x a m p l e   V i e w   t h e   P o d ' s   s p e c i f i c a t i o n :   k u b e c t l   g e t   p o d   d e f a u l t - m e m - d e m o - 3   - - o u t p u t = y a m l   - - n a m e s p a c e = d e f a u l t - m e m - e x a m p l e   T h e   o u t p u t   s h o w s   t h a t   t h e   c o n t a i n e r ' s   m e m o r y   r e q u e s t   i s   s e t   t o   t h e   v a l u e   s p e c i f i e d   i n   t h e   c o n t a i n e r ' s   m a n i f e s t .   T h e   c o n t a i n e r   i s   l i m i t e d   t o   u s e   n o   m o r e   t h a n   5 1 2 M i B   o f   m e m o r y ,   w h i c h   m a t c h e s   t h e   d e f a u l t   m e m o r y   l i m i t   f o r   t h e   n a m e s p a c e .   r e s o u r c e s :   l i m i t s :   m e m o r y :   5 1 2 M i   r e q u e s t s :   m e m o r y :   1 2 8 M i


Question: What is Motivation for default memory limits and requests?

Answer: I f   y o u r   n a m e s p a c e   h a s   a   m e m o r y   r e s o u r c e   q u o t a   c o n f i g u r e d ,   i t   i s   h e l p f u l   t o   h a v e   a   d e f a u l t   v a l u e   i n   p l a c e   f o r   m e m o r y   l i m i t .   H e r e   a r e   t h r e e   o f   t h e   r e s t r i c t i o n s   t h a t   a   r e s o u r c e   q u o t a   i m p o s e s   o n   a   n a m e s p a c e :   F o r   e v e r y   P o d   t h a t   r u n s   i n   t h e   n a m e s p a c e ,   t h e   P o d   a n d   e a c h   o f   i t s   c o n t a i n e r s   m u s t   h a v e   a   m e m o r y   l i m i t .   ( I f   y o u   s p e c i f y   a   m e m o r y   l i m i t   f o r   e v e r y   c o n t a i n e r   i n   a   P o d ,   K u b e r n e t e s   c a n   i n f e r   t h e   P o d - l e v e l   m e m o r y   l i m i t   b y   a d d i n g   u p   t h e   l i m i t s   f o r   i t s   c o n t a i n e r s ) . M e m o r y   l i m i t s   a p p l y   a   r e s o u r c e   r e s e r v a t i o n   o n   t h e   n o d e   w h e r e   t h e   P o d   i n   q u e s t i o n   i s   s c h e d u l e d .   T h e   t o t a l   a m o u n t   o f   m e m o r y   r e s e r v e d   f o r   a l l   P o d s   i n   t h e   n a m e s p a c e   m u s t   n o t   e x c e e d   a   s p e c i f i e d   l i m i t . T h e   t o t a l   a m o u n t   o f   m e m o r y   a c t u a l l y   u s e d   b y   a l l   P o d s   i n   t h e   n a m e s p a c e   m u s t   a l s o   n o t   e x c e e d   a   s p e c i f i e d   l i m i t .   W h e n   y o u   a d d   a   L i m i t R a n g e :   I f   a n y   P o d   i n   t h a t   n a m e s p a c e   t h a t   i n c l u d e s   a   c o n t a i n e r   d o e s   n o t   s p e c i f y   i t s   o w n   m e m o r y   l i m i t ,   t h e   c o n t r o l   p l a n e   a p p l i e s   t h e   d e f a u l t   m e m o r y   l i m i t   t o   t h a t   c o n t a i n e r ,   a n d   t h e   P o d   c a n   b e   a l l o w e d   t o   r u n   i n   a   n a m e s


Question: What is Clean up?

Answer: D e l e t e   y o u r   n a m e s p a c e :   k u b e c t l   d e l e t e   n a m e s p a c e   d e f a u l t - m e m - e x a m p l e


Question: What is For cluster administrators?

Answer: C o n f i g u r e   D e f a u l t   C P U   R e q u e s t s   a n d   L i m i t s   f o r   a   N a m e s p a c e C o n f i g u r e   M i n i m u m   a n d   M a x i m u m   M e m o r y   C o n s t r a i n t s   f o r   a   N a m e s p a c e C o n f i g u r e   M i n i m u m   a n d   M a x i m u m   C P U   C o n s t r a i n t s   f o r   a   N a m e s p a c e C o n f i g u r e   M e m o r y   a n d   C P U   Q u o t a s   f o r   a   N a m e s p a c e C o n f i g u r e   a   P o d   Q u o t a   f o r   a   N a m e s p a c e C o n f i g u r e   Q u o t a s   f o r   A P I   O b j e c t s   C o n f i g u r e   D e f a u l t   C P U   R e q u e s t s   a n d   L i m i t s   f o r   a   N a m e s p a c e   C o n f i g u r e   M i n i m u m   a n d   M a x i m u m   M e m o r y   C o n s t r a i n t s   f o r   a   N a m e s p a c e   C o n f i g u r e   M i n i m u m   a n d   M a x i m u m   C P U   C o n s t r a i n t s   f o r   a   N a m e s p a c e   C o n f i g u r e   M e m o r y   a n d   C P U   Q u o t a s   f o r   a   N a m e s p a c e   C o n f i g u r e   a   P o d   Q u o t a   f o r   a   N a m e s p a c e   C o n f i g u r e   Q u o t a s   f o r   A P I   O b j e c t s


Question: What is For app developers?

Answer: A s s i g n   M e m o r y   R e s o u r c e s   t o   C o n t a i n e r s   a n d   P o d s A s s i g n   C P U   R e s o u r c e s   t o   C o n t a i n e r s   a n d   P o d s A s s i g n   P o d - l e v e l   C P U   a n d   m e m o r y   r e s o u r c e s C o n f i g u r e   Q u a l i t y   o f   S e r v i c e   f o r   P o d s   A s s i g n   M e m o r y   R e s o u r c e s   t o   C o n t a i n e r s   a n d   P o d s   A s s i g n   C P U   R e s o u r c e s   t o   C o n t a i n e r s   a n d   P o d s   A s s i g n   P o d - l e v e l   C P U   a n d   m e m o r y   r e s o u r c e s   C o n f i g u r e   Q u a l i t y   o f   S e r v i c e   f o r   P o d s


Question: What is kubectl config delete-cluster?

Answer: kubectl config delete-clusterSynopsisDelete the specified cluster from the kubeconfig.kubectl config delete-cluster NAME Examples # Delete the minikube cluster kubectl config delete-cluster minikube Options-h, --helphelp for delete-clusterParent Options Inherited--as stringUsername to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group stringsGroup to impersonate for the operation, this flag can be repeated to specify multiple groups.--as-uid stringUID to impersonate for the operation.--cache-dir string Default: "$HOME/.kube/cache"Default cache directory--certificate-authority stringPath to a cert file for the certificate authority--client-certificate stringPath to a client certificate file for TLS--client-key stringPath to a client key file for TLS--cluster stringThe name of the kubeconfig cluster to use--context stringThe name of the kubeconfig context to use--disable-compressionIf true, opt-out of response compression for all requests to the server--insecure-skip-tls-verifyIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure--kubeconfig stringuse a particular kubeconfig file--kuberc stringPath to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.--match-server-versionRequire server version to match client version-n, --namespace stringIf present, the namespace scope for this CLI request--password stringPassword for basic authentication to the API server--profile string Default: "none"Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)--profile-output string Default: "profile.pprof"Name of the file to write the profile to--request-timeout string Default: "0"The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.-s, --server stringThe address and port of the Kubernetes API server--storage-driver-buffer-duration duration Default: 1m0sWrites in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction--storage-driver-db string Default: "cadvisor"database name--storage-driver-host string Default: "localhost:8086"database host:port--storage-driver-password string Default: "root"database password--storage-driver-secureuse secure connection with database--storage-driver-table string Default: "stats"table name--storage-driver-user string Default: "root"database username--tls-server-name stringServer name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used--token stringBearer token for authentication to the API server--user stringThe name of the kubeconfig user to use--username stringUsername for basic authentication to the API server--version version[=tru