Question: What is PersistentVolumeClaim retention?

Answer: T h e   o p t i o n a l   . s p e c . p e r s i s t e n t V o l u m e C l a i m R e t e n t i o n P o l i c y   f i e l d   c o n t r o l s   i f   a n d   h o w   P V C s   a r e   d e l e t e d   d u r i n g   t h e   l i f e c y c l e   o f   a   S t a t e f u l S e t .   Y o u   m u s t   e n a b l e   t h e   S t a t e f u l S e t A u t o D e l e t e P V C   f e a t u r e   g a t e   o n   t h e   A P I   s e r v e r   a n d   t h e   c o n t r o l l e r   m a n a g e r   t o   u s e   t h i s   f i e l d .   O n c e   e n a b l e d ,   t h e r e   a r e   t w o   p o l i c i e s   y o u   c a n   c o n f i g u r e   f o r   e a c h   S t a t e f u l S e t :   F o r   e a c h   p o l i c y   t h a t   y o u   c a n   c o n f i g u r e ,   y o u   c a n   s e t   t h e   v a l u e   t o   e i t h e r   D e l e t e   o r   R e t a i n .   B e a r   i n   m i n d   t h a t   t h e s e   p o l i c i e s   o n l y   a p p l y   w h e n   P o d s   a r e   b e i n g   r e m o v e d   d u e   t o   t h e   S t a t e f u l S e t   b e i n g   d e l e t e d   o r   s c a l e d   d o w n .   F o r   e x a m p l e ,   i f   a   P o d   a s s o c i a t e d   w i t h   a   S t a t e f u l S e t   f a i l s   d u e   t o   n o d e   f a i l u r e ,   a n d   t h e   c o n t r o l   p l a n e   c r e a t e s   a   r e p l a c e m e n t   P o d ,   t h e   S t a t e f u l S e t   r e t a i n s   t h e   e x i s t i n g   P V C .   T h e   e x i s t i n g   v o l u m e   i s   u n a f f e c t e d ,   a n d   t h e   c l u s t e r   w i l l   a t t a c h   i t   t o   t h e   n o d e   w h e r e   t h e   n e w   P o d   i s   a b o u t   t o   l a u n c h .   T h e   d e f a u l t   f o r   p o l i c i e s   i s   R e t a i n ,   m a t c h i n g   t h e   S t a t e f u l S e t   b e h a v i o r   b e f o r e   t h i s   n e w   f e a t u r e .   H e r e   i s   a n   e x a m p l e   p o l i c y .   a p i V e r s i o n :   a p p s / v 1   k i n d :   S t a t e f u l S e t   . .


Question: What is Replicas?

Answer: . s p e c . r e p l i c a s   i s   a n   o p t i o n a l   f i e l d   t h a t   s p e c i f i e s   t h e   n u m b e r   o f   d e s i r e d   P o d s .   I t   d e f a u l t s   t o   1 .   S h o u l d   y o u   m a n u a l l y   s c a l e   a   d e p l o y m e n t ,   e x a m p l e   v i a   k u b e c t l   s c a l e   s t a t e f u l s e t   s t a t e f u l s e t   - - r e p l i c a s = X ,   a n d   t h e n   y o u   u p d a t e   t h a t   S t a t e f u l S e t   b a s e d   o n   a   m a n i f e s t   ( f o r   e x a m p l e :   b y   r u n n i n g   k u b e c t l   a p p l y   - f   s t a t e f u l s e t . y a m l ) ,   t h e n   a p p l y i n g   t h a t   m a n i f e s t   o v e r w r i t e s   t h e   m a n u a l   s c a l i n g   t h a t   y o u   p r e v i o u s l y   d i d .   I f   a   H o r i z o n t a l P o d A u t o s c a l e r   ( o r   a n y   s i m i l a r   A P I   f o r   h o r i z o n t a l   s c a l i n g )   i s   m a n a g i n g   s c a l i n g   f o r   a   S t a t e f u l s e t ,   d o n ' t   s e t   . s p e c . r e p l i c a s .   I n s t e a d ,   a l l o w   t h e   K u b e r n e t e s   c o n t r o l   p l a n e   t o   m a n a g e   t h e   . s p e c . r e p l i c a s   f i e l d   a u t o m a t i c a l l y .


Question: What is What's next?

Answer: L e a r n   a b o u t   P o d s . F i n d   o u t   h o w   t o   u s e   S t a t e f u l S e t s F o l l o w   a n   e x a m p l e   o f   d e p l o y i n g   a   s t a t e f u l   a p p l i c a t i o n . F o l l o w   a n   e x a m p l e   o f   d e p l o y i n g   C a s s a n d r a   w i t h   S t a t e f u l   S e t s . F o l l o w   a n   e x a m p l e   o f   r u n n i n g   a   r e p l i c a t e d   s t a t e f u l   a p p l i c a t i o n . L e a r n   h o w   t o   s c a l e   a   S t a t e f u l S e t . L e a r n   w h a t ' s   i n v o l v e d   w h e n   y o u   d e l e t e   a   S t a t e f u l S e t . L e a r n   h o w   t o   c o n f i g u r e   a   P o d   t o   u s e   a   v o l u m e   f o r   s t o r a g e . L e a r n   h o w   t o   c o n f i g u r e   a   P o d   t o   u s e   a   P e r s i s t e n t V o l u m e   f o r   s t o r a g e . S t a t e f u l S e t   i s   a   t o p - l e v e l   r e s o u r c e   i n   t h e   K u b e r n e t e s   R E S T   A P I .   R e a d   t h e   S t a t e f u l S e t   o b j e c t   d e f i n i t i o n   t o   u n d e r s t a n d   t h e   A P I   f o r   s t a t e f u l   s e t s . R e a d   a b o u t   P o d D i s r u p t i o n B u d g e t   a n d   h o w   y o u   c a n   u s e   i t   t o   m a n a g e   a p p l i c a t i o n   a v a i l a b i l i t y   d u r i n g   d i s r u p t i o n s .   F o l l o w   a n   e x a m p l e   o f   d e p l o y i n g   a   s t a t e f u l   a p p l i c a t i o n . F o l l o w   a n   e x a m p l e   o f   d e p l o y i n g   C a s s a n d r a   w i t h   S t a t e f u l   S e t s . F o l l o w   a n   e x a m p l e   o f   r u n n i n g   a   r e p l i c a t e d   s t a t e f u l   a p p l i c a t i o n . L e a r n   h o w   t o   s c a l e   a   S t a t e f u l S e t . L e a r n   w h a t ' s   i n v o l v e d   w h e n   y o u   d e l e t e   a   S t a t e f u l S e t . L e a r n   h o w   t o   c o n f i g u r e   a   P o d   t o   u s e   a   v o l u m e   f o r   s t


Question: What is Available Documentation Versions?

Answer: Available Documentation VersionsThis website contains documentation for the current version of Kubernetes and the four previous versions of Kubernetes.The availability of documentation for a Kubernetes version is separate from whether that release is currently supported. Read Support period to learn about which versions of Kubernetes are officially supported, and for how long.Latest versionv1.34 (this documentation)Older versionsv1.33v1.32v1.31v1.30


Question: How does Available Documentation Versions work?

Answer: Available Documentation VersionsThis website contains documentation for the current version of Kubernetes and the four previous versions of Kubernetes.The availability of documentation for a Kubernetes version is separate from whether that release is currently supported. Read Support period to learn about which versions of Kubernetes are officially supported, and for how long.Latest versionv1.34 (this documentation)Older versionsv1.33v1.32v1.31v1.30


Question: When would you use Available Documentation Versions?

Answer: Available Documentation VersionsThis website contains documentation for the current version of Kubernetes and the four previous versions of Kubernetes.The availability of documentation for a Kubernetes version is separate from whether that release is currently supported. Read Support period to learn about which versions of Kubernetes are officially supported, and for how long.Latest versionv1.34 (this documentation)Older versionsv1.33v1.32v1.31v1.30


Question: What are the benefits of Available Documentation Versions?

Answer: Available Documentation VersionsThis website contains documentation for the current version of Kubernetes and the four previous versions of Kubernetes.The availability of documentation for a Kubernetes version is separate from whether that release is currently supported. Read Support period to learn about which versions of Kubernetes are officially supported, and for how long.Latest versionv1.34 (this documentation)Older versionsv1.33v1.32v1.31v1.30


Question: What is Available Documentation Versions?

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


Question: What is Latest version?

Answer: v 1 . 3 4   ( t h i s   d o c u m e n t a t i o n )


Question: What is Older versions?

Answer: v 1 . 3 3 v 1 . 3 2 v 1 . 3 1 v 1 . 3 0


Question: What is Define Environment Variables for a Container?

Answer: Define Environment Variables for a ContainerThis page shows how to define environment variables for a container in a Kubernetes Pod.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 KubernetesDefine an environment variable for a containerWhen you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the env or envFrom field in the configuration file.The env and envFrom fields have different effects.envallows you to set environment variables for a container, specifying a value directly for each variable that you name.envFromallows you to set environment variables for a container by referencing either a ConfigMap or a Secret. When you use envFrom, all the key-value pairs in the referenced ConfigMap or Secret are set as environment variables for the container. You can also specify a common prefix string.You can read more about ConfigMap and Secret.This page explains how to use env.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name DEMO_GREETING and value "Hello from the environment". Here is the configuration manifest for the Pod:pods/inject/envars.yaml apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.io/google-samples/hello-app:2.0 env: - name: DEMO_GREETING value: "Hello from the environment" - name: DEMO_FAREWELL value: "Such a sweet sorrow" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml List the running Pods:kubectl get pods -l purpose=demonstrate-envars The output is similar to:NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s List the Pod's container environment variables:kubectl exec envar-demo -- printenv The output is similar to this:NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo ... DEMO_GREETING=Hello from the environment DEMO_FAREWELL=Such a sweet sorrow Note:The environment variables set using the env or envFrom field override any environment variables specified in the container image.Note:Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.Using environment variables inside of your configEnvironment variables that you define in a Pod's configuration under .spec.containers[*].env[*] can be used elsewhere in the configuration, for example in commands and arguments t


Question: How does Define Environment Variables for a Container work?

Answer: Define Environment Variables for a ContainerThis page shows how to define environment variables for a container in a Kubernetes Pod.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 KubernetesDefine an environment variable for a containerWhen you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the env or envFrom field in the configuration file.The env and envFrom fields have different effects.envallows you to set environment variables for a container, specifying a value directly for each variable that you name.envFromallows you to set environment variables for a container by referencing either a ConfigMap or a Secret. When you use envFrom, all the key-value pairs in the referenced ConfigMap or Secret are set as environment variables for the container. You can also specify a common prefix string.You can read more about ConfigMap and Secret.This page explains how to use env.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name DEMO_GREETING and value "Hello from the environment". Here is the configuration manifest for the Pod:pods/inject/envars.yaml apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.io/google-samples/hello-app:2.0 env: - name: DEMO_GREETING value: "Hello from the environment" - name: DEMO_FAREWELL value: "Such a sweet sorrow" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml List the running Pods:kubectl get pods -l purpose=demonstrate-envars The output is similar to:NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s List the Pod's container environment variables:kubectl exec envar-demo -- printenv The output is similar to this:NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo ... DEMO_GREETING=Hello from the environment DEMO_FAREWELL=Such a sweet sorrow Note:The environment variables set using the env or envFrom field override any environment variables specified in the container image.Note:Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.Using environment variables inside of your configEnvironment variables that you define in a Pod's configuration under .spec.containers[*].env[*] can be used elsewhere in the configuration, for example in commands and arguments t


Question: When would you use Define Environment Variables for a Container?

Answer: Define Environment Variables for a ContainerThis page shows how to define environment variables for a container in a Kubernetes Pod.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 KubernetesDefine an environment variable for a containerWhen you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the env or envFrom field in the configuration file.The env and envFrom fields have different effects.envallows you to set environment variables for a container, specifying a value directly for each variable that you name.envFromallows you to set environment variables for a container by referencing either a ConfigMap or a Secret. When you use envFrom, all the key-value pairs in the referenced ConfigMap or Secret are set as environment variables for the container. You can also specify a common prefix string.You can read more about ConfigMap and Secret.This page explains how to use env.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name DEMO_GREETING and value "Hello from the environment". Here is the configuration manifest for the Pod:pods/inject/envars.yaml apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.io/google-samples/hello-app:2.0 env: - name: DEMO_GREETING value: "Hello from the environment" - name: DEMO_FAREWELL value: "Such a sweet sorrow" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml List the running Pods:kubectl get pods -l purpose=demonstrate-envars The output is similar to:NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s List the Pod's container environment variables:kubectl exec envar-demo -- printenv The output is similar to this:NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo ... DEMO_GREETING=Hello from the environment DEMO_FAREWELL=Such a sweet sorrow Note:The environment variables set using the env or envFrom field override any environment variables specified in the container image.Note:Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.Using environment variables inside of your configEnvironment variables that you define in a Pod's configuration under .spec.containers[*].env[*] can be used elsewhere in the configuration, for example in commands and arguments t


Question: What are the benefits of Define Environment Variables for a Container?

Answer: Define Environment Variables for a ContainerThis page shows how to define environment variables for a container in a Kubernetes Pod.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 KubernetesDefine an environment variable for a containerWhen you create a Pod, you can set environment variables for the containers that run in the Pod. To set environment variables, include the env or envFrom field in the configuration file.The env and envFrom fields have different effects.envallows you to set environment variables for a container, specifying a value directly for each variable that you name.envFromallows you to set environment variables for a container by referencing either a ConfigMap or a Secret. When you use envFrom, all the key-value pairs in the referenced ConfigMap or Secret are set as environment variables for the container. You can also specify a common prefix string.You can read more about ConfigMap and Secret.This page explains how to use env.In this exercise, you create a Pod that runs one container. The configuration file for the Pod defines an environment variable with name DEMO_GREETING and value "Hello from the environment". Here is the configuration manifest for the Pod:pods/inject/envars.yaml apiVersion: v1 kind: Pod metadata: name: envar-demo labels: purpose: demonstrate-envars spec: containers: - name: envar-demo-container image: gcr.io/google-samples/hello-app:2.0 env: - name: DEMO_GREETING value: "Hello from the environment" - name: DEMO_FAREWELL value: "Such a sweet sorrow" Create a Pod based on that manifest:kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml List the running Pods:kubectl get pods -l purpose=demonstrate-envars The output is similar to:NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s List the Pod's container environment variables:kubectl exec envar-demo -- printenv The output is similar to this:NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo ... DEMO_GREETING=Hello from the environment DEMO_FAREWELL=Such a sweet sorrow Note:The environment variables set using the env or envFrom field override any environment variables specified in the container image.Note:Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.Using environment variables inside of your configEnvironment variables that you define in a Pod's configuration under .spec.containers[*].env[*] can be used elsewhere in the configuration, for example in commands and arguments t


Question: What is Define Environment Variables for a Container?

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


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


Question: What is Define an environment variable for a container?

Answer: W h e n   y o u   c r e a t e   a   P o d ,   y o u   c a n   s e t   e n v i r o n m e n t   v a r i a b l e s   f o r   t h e   c o n t a i n e r s   t h a t   r u n   i n   t h e   P o d .   T o   s e t   e n v i r o n m e n t   v a r i a b l e s ,   i n c l u d e   t h e   e n v   o r   e n v F r o m   f i e l d   i n   t h e   c o n f i g u r a t i o n   f i l e .   T h e   e n v   a n d   e n v F r o m   f i e l d s   h a v e   d i f f e r e n t   e f f e c t s .   Y o u   c a n   r e a d   m o r e   a b o u t   C o n f i g M a p   a n d   S e c r e t .   T h i s   p a g e   e x p l a i n s   h o w   t o   u s e   e n v .   I n   t h i s   e x e r c i s e ,   y o u   c r e a t e   a   P o d   t h a t   r u n s   o n e   c o n t a i n e r .   T h e   c o n f i g u r a t i o n   f i l e   f o r   t h e   P o d   d e f i n e s   a n   e n v i r o n m e n t   v a r i a b l e   w i t h   n a m e   D E M O _ G R E E T I N G   a n d   v a l u e   " H e l l o   f r o m   t h e   e n v i r o n m e n t " .   H e r e   i s   t h e   c o n f i g u r a t i o n   m a n i f e s t   f o r   t h e   P o d :   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 :   e n v a r - d e m o   l a b e l s :   p u r p o s e :   d e m o n s t r a t e - e n v a r s   s p e c :   c o n t a i n e r s :   -   n a m e :   e n v a r - d e m o - c o n t a i n e r   i m a g e :   g c r . i o / g o o g l e - s a m p l e s / h e l l o - a p p : 2 . 0   e n v :   -   n a m e :   D E M O _ G R E E T I N G   v a l u e :   " H e l l o   f r o m   t h e   e n v i r o n m e n t "   -   n a m e :   D E M O _ F A R E W E L L   v a l u e :   " S u c h   a   s w e e t   s o r r o w "   C r e a t e   a   P o d   b a s e d   o n   t h a t   m a n i f e s t : 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 / p o d s / i n j e c t / e n v a r s . y a m l   L i s t   t h e   r u n n i n g   P o d s : k u b e c t l   g e t   p o d s   - l   p u r p o s e


Question: What is Using environment variables inside of your config?

Answer: E n v i r o n m e n t   v a r i a b l e s   t h a t   y o u   d e f i n e   i n   a   P o d ' s   c o n f i g u r a t i o n   u n d e r   . s p e c . c o n t a i n e r s [ * ] . e n v [ * ]   c a n   b e   u s e d   e l s e w h e r e   i n   t h e   c o n f i g u r a t i o n ,   f o r   e x a m p l e   i n   c o m m a n d s   a n d   a r g u m e n t s   t h a t   y o u   s e t   f o r   t h e   P o d ' s   c o n t a i n e r s .   I n   t h e   e x a m p l e   c o n f i g u r a t i o n   b e l o w ,   t h e   G R E E T I N G ,   H O N O R I F I C ,   a n d   N A M E   e n v i r o n m e n t   v a r i a b l e s   a r e   s e t   t o   W a r m   g r e e t i n g s   t o ,   T h e   M o s t   H o n o r a b l e ,   a n d   K u b e r n e t e s ,   r e s p e c t i v e l y .   T h e   e n v i r o n m e n t   v a r i a b l e   M E S S A G E   c o m b i n e s   t h e   s e t   o f   a l l   t h e s e   e n v i r o n m e n t   v a r i a b l e s   a n d   t h e n   u s e s   i t   a s   a   C L I   a r g u m e n t   p a s s e d   t o   t h e   e n v - p r i n t - d e m o   c o n t a i n e r .   E n v i r o n m e n t   v a r i a b l e   n a m e s   m a y   c o n s i s t   o f   a n y   p r i n t a b l e   A S C I I   c h a r a c t e r s   e x c e p 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 :   p r i n t - g r e e t i n g   s p e c :   c o n t a i n e r s :   -   n a m e :   e n v - p r i n t - d e m o   i m a g e :   b a s h   e n v :   -   n a m e :   G R E E T I N G   v a l u e :   " W a r m   g r e e t i n g s   t o "   -   n a m e :   H O N O R I F I C   v a l u e :   " T h e   M o s t   H o n o r a b l e "   -   n a m e :   N A M E   v a l u e :   " K u b e r n e t e s "   -   n a m e :   M E S S A G E   v a l u e :   " $ ( G R E E T I N G )   $ ( H O N O R I F I C )   $ ( N A M E ) "   c o m m a n d :   [ " e c h o " ]   a r g s :   [ " $ ( M E S S A G E ) " ]   U p o n   c r e a t i o n ,   t h e   c o m m a n d   e c h o


Question: What is What's next?

Answer: L e a r n   m o r e   a b o u t   e n v i r o n m e n t   v a r i a b l e s . L e a r n   a b o u t   u s i n g   s e c r e t s   a s   e n v i r o n m e n t   v a r i a b l e s . S e e   E n v V a r S o u r c e .


Question: What is Field Selectors?

Answer: Field SelectorsField selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:metadata.name=my-servicemetadata.namespace!=defaultstatus.phase=PendingThis kubectl command selects all Pods for which the value of the status.phase field is Running:kubectl get pods --field-selector status.phase=Running Note:Field selectors are essentially resource filters. By default, no selectors/filters are applied, meaning that all resources of the specified type are selected. This makes the kubectl queries kubectl get pods and kubectl get pods --field-selector "" equivalent.Supported fieldsSupported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example:kubectl get ingress --field-selector foo.bar=baz Error from server (BadRequest): Unable to find "ingresses" that match label selector "", field selector "foo.bar=baz": "foo.bar" is not a known field selector: only "metadata.name", "metadata.namespace" List of supported fieldsKindFieldsPodspec.nodeNamespec.restartPolicyspec.schedulerNamespec.serviceAccountNamespec.hostNetworkstatus.phasestatus.podIPstatus.nominatedNodeNameEventinvolvedObject.kindinvolvedObject.namespaceinvolvedObject.nameinvolvedObject.uidinvolvedObject.apiVersioninvolvedObject.resourceVersioninvolvedObject.fieldPathreasonreportingComponentsourcetypeSecrettypeNamespacestatus.phaseReplicaSetstatus.replicasReplicationControllerstatus.replicasJobstatus.successfulNodespec.unschedulableCertificateSigningRequestspec.signerNameCustom resources fieldsAll custom resource types support the metadata.name and metadata.namespace fields.Additionally, the spec.versions[*].selectableFields field of a CustomResourceDefinition declares which other fields in a custom resource may be used in field selectors. See selectable fields for custom resources for more information about how to use field selectors with CustomResourceDefinitions.Supported operatorsYou can use the =, ==, and != operators with field selectors (= and == mean the same thing). This kubectl command, for example, selects all Kubernetes Services that aren't in the default namespace:kubectl get services --all-namespaces --field-selector metadata.namespace!=default Note:Set-based operators (in, notin, exists) are not supported for field selectors.Chained selectorsAs with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the spec.restartPolicy field equals Always:kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always Multiple resource typesYou can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:kubectl get statefulsets,services --


Question: How does Field Selectors work?

Answer: Field SelectorsField selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:metadata.name=my-servicemetadata.namespace!=defaultstatus.phase=PendingThis kubectl command selects all Pods for which the value of the status.phase field is Running:kubectl get pods --field-selector status.phase=Running Note:Field selectors are essentially resource filters. By default, no selectors/filters are applied, meaning that all resources of the specified type are selected. This makes the kubectl queries kubectl get pods and kubectl get pods --field-selector "" equivalent.Supported fieldsSupported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example:kubectl get ingress --field-selector foo.bar=baz Error from server (BadRequest): Unable to find "ingresses" that match label selector "", field selector "foo.bar=baz": "foo.bar" is not a known field selector: only "metadata.name", "metadata.namespace" List of supported fieldsKindFieldsPodspec.nodeNamespec.restartPolicyspec.schedulerNamespec.serviceAccountNamespec.hostNetworkstatus.phasestatus.podIPstatus.nominatedNodeNameEventinvolvedObject.kindinvolvedObject.namespaceinvolvedObject.nameinvolvedObject.uidinvolvedObject.apiVersioninvolvedObject.resourceVersioninvolvedObject.fieldPathreasonreportingComponentsourcetypeSecrettypeNamespacestatus.phaseReplicaSetstatus.replicasReplicationControllerstatus.replicasJobstatus.successfulNodespec.unschedulableCertificateSigningRequestspec.signerNameCustom resources fieldsAll custom resource types support the metadata.name and metadata.namespace fields.Additionally, the spec.versions[*].selectableFields field of a CustomResourceDefinition declares which other fields in a custom resource may be used in field selectors. See selectable fields for custom resources for more information about how to use field selectors with CustomResourceDefinitions.Supported operatorsYou can use the =, ==, and != operators with field selectors (= and == mean the same thing). This kubectl command, for example, selects all Kubernetes Services that aren't in the default namespace:kubectl get services --all-namespaces --field-selector metadata.namespace!=default Note:Set-based operators (in, notin, exists) are not supported for field selectors.Chained selectorsAs with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the spec.restartPolicy field equals Always:kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always Multiple resource typesYou can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:kubectl get statefulsets,services --


Question: When would you use Field Selectors?

Answer: Field SelectorsField selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:metadata.name=my-servicemetadata.namespace!=defaultstatus.phase=PendingThis kubectl command selects all Pods for which the value of the status.phase field is Running:kubectl get pods --field-selector status.phase=Running Note:Field selectors are essentially resource filters. By default, no selectors/filters are applied, meaning that all resources of the specified type are selected. This makes the kubectl queries kubectl get pods and kubectl get pods --field-selector "" equivalent.Supported fieldsSupported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example:kubectl get ingress --field-selector foo.bar=baz Error from server (BadRequest): Unable to find "ingresses" that match label selector "", field selector "foo.bar=baz": "foo.bar" is not a known field selector: only "metadata.name", "metadata.namespace" List of supported fieldsKindFieldsPodspec.nodeNamespec.restartPolicyspec.schedulerNamespec.serviceAccountNamespec.hostNetworkstatus.phasestatus.podIPstatus.nominatedNodeNameEventinvolvedObject.kindinvolvedObject.namespaceinvolvedObject.nameinvolvedObject.uidinvolvedObject.apiVersioninvolvedObject.resourceVersioninvolvedObject.fieldPathreasonreportingComponentsourcetypeSecrettypeNamespacestatus.phaseReplicaSetstatus.replicasReplicationControllerstatus.replicasJobstatus.successfulNodespec.unschedulableCertificateSigningRequestspec.signerNameCustom resources fieldsAll custom resource types support the metadata.name and metadata.namespace fields.Additionally, the spec.versions[*].selectableFields field of a CustomResourceDefinition declares which other fields in a custom resource may be used in field selectors. See selectable fields for custom resources for more information about how to use field selectors with CustomResourceDefinitions.Supported operatorsYou can use the =, ==, and != operators with field selectors (= and == mean the same thing). This kubectl command, for example, selects all Kubernetes Services that aren't in the default namespace:kubectl get services --all-namespaces --field-selector metadata.namespace!=default Note:Set-based operators (in, notin, exists) are not supported for field selectors.Chained selectorsAs with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the spec.restartPolicy field equals Always:kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always Multiple resource typesYou can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:kubectl get statefulsets,services --


Question: What are the benefits of Field Selectors?

Answer: Field SelectorsField selectors let you select Kubernetes objects based on the value of one or more resource fields. Here are some examples of field selector queries:metadata.name=my-servicemetadata.namespace!=defaultstatus.phase=PendingThis kubectl command selects all Pods for which the value of the status.phase field is Running:kubectl get pods --field-selector status.phase=Running Note:Field selectors are essentially resource filters. By default, no selectors/filters are applied, meaning that all resources of the specified type are selected. This makes the kubectl queries kubectl get pods and kubectl get pods --field-selector "" equivalent.Supported fieldsSupported field selectors vary by Kubernetes resource type. All resource types support the metadata.name and metadata.namespace fields. Using unsupported field selectors produces an error. For example:kubectl get ingress --field-selector foo.bar=baz Error from server (BadRequest): Unable to find "ingresses" that match label selector "", field selector "foo.bar=baz": "foo.bar" is not a known field selector: only "metadata.name", "metadata.namespace" List of supported fieldsKindFieldsPodspec.nodeNamespec.restartPolicyspec.schedulerNamespec.serviceAccountNamespec.hostNetworkstatus.phasestatus.podIPstatus.nominatedNodeNameEventinvolvedObject.kindinvolvedObject.namespaceinvolvedObject.nameinvolvedObject.uidinvolvedObject.apiVersioninvolvedObject.resourceVersioninvolvedObject.fieldPathreasonreportingComponentsourcetypeSecrettypeNamespacestatus.phaseReplicaSetstatus.replicasReplicationControllerstatus.replicasJobstatus.successfulNodespec.unschedulableCertificateSigningRequestspec.signerNameCustom resources fieldsAll custom resource types support the metadata.name and metadata.namespace fields.Additionally, the spec.versions[*].selectableFields field of a CustomResourceDefinition declares which other fields in a custom resource may be used in field selectors. See selectable fields for custom resources for more information about how to use field selectors with CustomResourceDefinitions.Supported operatorsYou can use the =, ==, and != operators with field selectors (= and == mean the same thing). This kubectl command, for example, selects all Kubernetes Services that aren't in the default namespace:kubectl get services --all-namespaces --field-selector metadata.namespace!=default Note:Set-based operators (in, notin, exists) are not supported for field selectors.Chained selectorsAs with label and other selectors, field selectors can be chained together as a comma-separated list. This kubectl command selects all Pods for which the status.phase does not equal Running and the spec.restartPolicy field equals Always:kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Always Multiple resource typesYou can use field selectors across multiple resource types. This kubectl command selects all Statefulsets and Services that are not in the default namespace:kubectl get statefulsets,services --


Question: What is Field Selectors?

Answer: F i e l d   s e l e c t o r s   l e t   y o u   s e l e c t   K u b e r n e t e s   o b j e c t s   b a s e d   o n   t h e   v a l u e   o f   o n e   o r   m o r e   r e s o u r c e   f i e l d s .   H e r e   a r e   s o m e   e x a m p l e s   o f   f i e l d   s e l e c t o r   q u e r i e s :   m e t a d a t a . n a m e = m y - s e r v i c e m e t a d a t a . n a m e s p a c e ! = d e f a u l t s t a t u s . p h a s e = P e n d i n g   T h i s   k u b e c t l   c o m m a n d   s e l e c t s   a l l   P o d s   f o r   w h i c h   t h e   v a l u e   o f   t h e   s t a t u s . p h a s e   f i e l d   i s   R u n n i n g :   k u b e c t l   g e t   p o d s   - - f i e l d - s e l e c t o r   s t a t u s . p h a s e = R u n n i n g


Question: What is Supported fields?

Answer: S u p p o r t e d   f i e l d   s e l e c t o r s   v a r y   b y   K u b e r n e t e s   r e s o u r c e   t y p e .   A l l   r e s o u r c e   t y p e s   s u p p o r t   t h e   m e t a d a t a . n a m e   a n d   m e t a d a t a . n a m e s p a c e   f i e l d s .   U s i n g   u n s u p p o r t e d   f i e l d   s e l e c t o r s   p r o d u c e s   a n   e r r o r .   F o r   e x a m p l e :   k u b e c t l   g e t   i n g r e s s   - - f i e l d - s e l e c t o r   f o o . b a r = b a z   E r r o r   f r o m   s e r v e r   ( B a d R e q u e s t ) :   U n a b l e   t o   f i n d   " i n g r e s s e s "   t h a t   m a t c h   l a b e l   s e l e c t o r   " " ,   f i e l d   s e l e c t o r   " f o o . b a r = b a z " :   " f o o . b a r "   i s   n o t   a   k n o w n   f i e l d   s e l e c t o r :   o n l y   " m e t a d a t a . n a m e " ,   " m e t a d a t a . n a m e s p a c e "


Question: What is Custom resources fields?

Answer: A l l   c u s t o m   r e s o u r c e   t y p e s   s u p p o r t   t h e   m e t a d a t a . n a m e   a n d   m e t a d a t a . n a m e s p a c e   f i e l d s .   A d d i t i o n a l l y ,   t h e   s p e c . v e r s i o n s [ * ] . s e l e c t a b l e F i e l d s   f i e l d   o f   a   C u s t o m R e s o u r c e D e f i n i t i o n   d e c l a r e s   w h i c h   o t h e r   f i e l d s   i n   a   c u s t o m   r e s o u r c e   m a y   b e   u s e d   i n   f i e l d   s e l e c t o r s .   S e e   s e l e c t a b l e   f i e l d s   f o r   c u s t o m   r e s o u r c e s   f o r   m o r e   i n f o r m a t i o n   a b o u t   h o w   t o   u s e   f i e l d   s e l e c t o r s   w i t h   C u s t o m R e s o u r c e D e f i n i t i o n s .


Question: What is Supported operators?

Answer: Y o u   c a n   u s e   t h e   = ,   = = ,   a n d   ! =   o p e r a t o r s   w i t h   f i e l d   s e l e c t o r s   ( =   a n d   = =   m e a n   t h e   s a m e   t h i n g ) .   T h i s   k u b e c t l   c o m m a n d ,   f o r   e x a m p l e ,   s e l e c t s   a l l   K u b e r n e t e s   S e r v i c e s   t h a t   a r e n ' t   i n   t h e   d e f a u l t   n a m e s p a c e :   k u b e c t l   g e t   s e r v i c e s   - - a l l - n a m e s p a c e s   - - f i e l d - s e l e c t o r   m e t a d a t a . n a m e s p a c e ! = d e f a u l t


Question: What is Chained selectors?

Answer: A s   w i t h   l a b e l   a n d   o t h e r   s e l e c t o r s ,   f i e l d   s e l e c t o r s   c a n   b e   c h a i n e d   t o g e t h e r   a s   a   c o m m a - s e p a r a t e d   l i s t .   T h i s   k u b e c t l   c o m m a n d   s e l e c t s   a l l   P o d s   f o r   w h i c h   t h e   s t a t u s . p h a s e   d o e s   n o t   e q u a l   R u n n i n g   a n d   t h e   s p e c . r e s t a r t P o l i c y   f i e l d   e q u a l s   A l w a y s :   k u b e c t l   g e t   p o d s   - - f i e l d - s e l e c t o r = s t a t u s . p h a s e ! = R u n n i n g , s p e c . r e s t a r t P o l i c y = A l w a y s


Question: What is Multiple resource types?

Answer: Y o u   c a n   u s e   f i e l d   s e l e c t o r s   a c r o s s   m u l t i p l e   r e s o u r c e   t y p e s .   T h i s   k u b e c t l   c o m m a n d   s e l e c t s   a l l   S t a t e f u l s e t s   a n d   S e r v i c e s   t h a t   a r e   n o t   i n   t h e   d e f a u l t   n a m e s p a c e :   k u b e c t l   g e t   s t a t e f u l s e t s , s e r v i c e s   - - a l l - n a m e s p a c e s   - - f i e l d - s e l e c t o r   m e t a d a t a . n a m e s p a c e ! = d e f a u l t


Question: What is Validate node setup?

Answer: Validate node setupNode Conformance TestNode conformance test is a containerized test framework that provides a system verification and functionality test for a node. The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the test is qualified to join a Kubernetes cluster.Node PrerequisiteTo run node conformance test, a node must satisfy the same prerequisites as a standard Kubernetes node. At a minimum, the node should have the following daemons installed:CRI-compatible container runtimes such as Docker, containerd and CRI-OkubeletRunning Node Conformance TestTo run the node conformance test, perform the following steps:Work out the value of the --kubeconfig option for the kubelet; for example: --kubeconfig=/var/lib/kubelet/config.yaml. Because the test framework starts a local control plane to test the kubelet, use http://localhost:8080 as the URL of the API server. There are some other kubelet command line parameters you may want to use:--cloud-provider: If you are using --cloud-provider=gce, you should remove the flag to run the test.Run the node conformance test with command:# $CONFIG_DIR is the pod manifest path of your kubelet. # $LOG_DIR is the test output path. sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ registry.k8s.io/node-test:0.2 Running Node Conformance Test for Other ArchitecturesKubernetes also provides node conformance test docker images for other architectures:ArchImageamd64node-test-amd64armnode-test-armarm64node-test-arm64Running Selected TestTo run specific tests, overwrite the environment variable FOCUS with the regular expression of tests you want to run.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e FOCUS=MirrorPod \ # Only run MirrorPod test registry.k8s.io/node-test:0.2 To skip specific tests, overwrite the environment variable SKIP with the regular expression of tests you want to skip.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e SKIP=MirrorPod \ # Run all conformance tests but skip MirrorPod test registry.k8s.io/node-test:0.2 Node conformance test is a containerized version of node e2e test. By default, it runs all conformance tests.Theoretically, you can run any node e2e test if you configure the container and mount required volumes properly. But it is strongly recommended to only run conformance test, because it requires much more complex configuration to run non-conformance test.CaveatsThe test leaves some docker images on the node, including the node conformance test image and images of containers used in the functionality test.The test leaves dead containers on the node. These containers are created during the functionality test.


Question: How does Validate node setup work?

Answer: Validate node setupNode Conformance TestNode conformance test is a containerized test framework that provides a system verification and functionality test for a node. The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the test is qualified to join a Kubernetes cluster.Node PrerequisiteTo run node conformance test, a node must satisfy the same prerequisites as a standard Kubernetes node. At a minimum, the node should have the following daemons installed:CRI-compatible container runtimes such as Docker, containerd and CRI-OkubeletRunning Node Conformance TestTo run the node conformance test, perform the following steps:Work out the value of the --kubeconfig option for the kubelet; for example: --kubeconfig=/var/lib/kubelet/config.yaml. Because the test framework starts a local control plane to test the kubelet, use http://localhost:8080 as the URL of the API server. There are some other kubelet command line parameters you may want to use:--cloud-provider: If you are using --cloud-provider=gce, you should remove the flag to run the test.Run the node conformance test with command:# $CONFIG_DIR is the pod manifest path of your kubelet. # $LOG_DIR is the test output path. sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ registry.k8s.io/node-test:0.2 Running Node Conformance Test for Other ArchitecturesKubernetes also provides node conformance test docker images for other architectures:ArchImageamd64node-test-amd64armnode-test-armarm64node-test-arm64Running Selected TestTo run specific tests, overwrite the environment variable FOCUS with the regular expression of tests you want to run.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e FOCUS=MirrorPod \ # Only run MirrorPod test registry.k8s.io/node-test:0.2 To skip specific tests, overwrite the environment variable SKIP with the regular expression of tests you want to skip.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e SKIP=MirrorPod \ # Run all conformance tests but skip MirrorPod test registry.k8s.io/node-test:0.2 Node conformance test is a containerized version of node e2e test. By default, it runs all conformance tests.Theoretically, you can run any node e2e test if you configure the container and mount required volumes properly. But it is strongly recommended to only run conformance test, because it requires much more complex configuration to run non-conformance test.CaveatsThe test leaves some docker images on the node, including the node conformance test image and images of containers used in the functionality test.The test leaves dead containers on the node. These containers are created during the functionality test.


Question: When would you use Validate node setup?

Answer: Validate node setupNode Conformance TestNode conformance test is a containerized test framework that provides a system verification and functionality test for a node. The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the test is qualified to join a Kubernetes cluster.Node PrerequisiteTo run node conformance test, a node must satisfy the same prerequisites as a standard Kubernetes node. At a minimum, the node should have the following daemons installed:CRI-compatible container runtimes such as Docker, containerd and CRI-OkubeletRunning Node Conformance TestTo run the node conformance test, perform the following steps:Work out the value of the --kubeconfig option for the kubelet; for example: --kubeconfig=/var/lib/kubelet/config.yaml. Because the test framework starts a local control plane to test the kubelet, use http://localhost:8080 as the URL of the API server. There are some other kubelet command line parameters you may want to use:--cloud-provider: If you are using --cloud-provider=gce, you should remove the flag to run the test.Run the node conformance test with command:# $CONFIG_DIR is the pod manifest path of your kubelet. # $LOG_DIR is the test output path. sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ registry.k8s.io/node-test:0.2 Running Node Conformance Test for Other ArchitecturesKubernetes also provides node conformance test docker images for other architectures:ArchImageamd64node-test-amd64armnode-test-armarm64node-test-arm64Running Selected TestTo run specific tests, overwrite the environment variable FOCUS with the regular expression of tests you want to run.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e FOCUS=MirrorPod \ # Only run MirrorPod test registry.k8s.io/node-test:0.2 To skip specific tests, overwrite the environment variable SKIP with the regular expression of tests you want to skip.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e SKIP=MirrorPod \ # Run all conformance tests but skip MirrorPod test registry.k8s.io/node-test:0.2 Node conformance test is a containerized version of node e2e test. By default, it runs all conformance tests.Theoretically, you can run any node e2e test if you configure the container and mount required volumes properly. But it is strongly recommended to only run conformance test, because it requires much more complex configuration to run non-conformance test.CaveatsThe test leaves some docker images on the node, including the node conformance test image and images of containers used in the functionality test.The test leaves dead containers on the node. These containers are created during the functionality test.


Question: What are the benefits of Validate node setup?

Answer: Validate node setupNode Conformance TestNode conformance test is a containerized test framework that provides a system verification and functionality test for a node. The test validates whether the node meets the minimum requirements for Kubernetes; a node that passes the test is qualified to join a Kubernetes cluster.Node PrerequisiteTo run node conformance test, a node must satisfy the same prerequisites as a standard Kubernetes node. At a minimum, the node should have the following daemons installed:CRI-compatible container runtimes such as Docker, containerd and CRI-OkubeletRunning Node Conformance TestTo run the node conformance test, perform the following steps:Work out the value of the --kubeconfig option for the kubelet; for example: --kubeconfig=/var/lib/kubelet/config.yaml. Because the test framework starts a local control plane to test the kubelet, use http://localhost:8080 as the URL of the API server. There are some other kubelet command line parameters you may want to use:--cloud-provider: If you are using --cloud-provider=gce, you should remove the flag to run the test.Run the node conformance test with command:# $CONFIG_DIR is the pod manifest path of your kubelet. # $LOG_DIR is the test output path. sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ registry.k8s.io/node-test:0.2 Running Node Conformance Test for Other ArchitecturesKubernetes also provides node conformance test docker images for other architectures:ArchImageamd64node-test-amd64armnode-test-armarm64node-test-arm64Running Selected TestTo run specific tests, overwrite the environment variable FOCUS with the regular expression of tests you want to run.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e FOCUS=MirrorPod \ # Only run MirrorPod test registry.k8s.io/node-test:0.2 To skip specific tests, overwrite the environment variable SKIP with the regular expression of tests you want to skip.sudo docker run -it --rm --privileged --net=host \ -v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \ -e SKIP=MirrorPod \ # Run all conformance tests but skip MirrorPod test registry.k8s.io/node-test:0.2 Node conformance test is a containerized version of node e2e test. By default, it runs all conformance tests.Theoretically, you can run any node e2e test if you configure the container and mount required volumes properly. But it is strongly recommended to only run conformance test, because it requires much more complex configuration to run non-conformance test.CaveatsThe test leaves some docker images on the node, including the node conformance test image and images of containers used in the functionality test.The test leaves dead containers on the node. These containers are created during the functionality test.


Question: What is Node Conformance Test?

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


Question: What is Node Prerequisite?

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


Question: What is Running Node Conformance Test?

Answer: T o   r u n   t h e   n o d e   c o n f o r m a n c e   t e s t ,   p e r f o r m   t h e   f o l l o w i n g   s t e p s :   W o r k   o u t   t h e   v a l u e   o f   t h e   - - k u b e c o n f i g   o p t i o n   f o r   t h e   k u b e l e t ;   f o r   e x a m p l e :   - - k u b e c o n f i g = / v a r / l i b / k u b e l e t / c o n f i g . y a m l .   B e c a u s e   t h e   t e s t   f r a m e w o r k   s t a r t s   a   l o c a l   c o n t r o l   p l a n e   t o   t e s t   t h e   k u b e l e t ,   u s e   h t t p : / / l o c a l h o s t : 8 0 8 0   a s   t h e   U R L   o f   t h e   A P I   s e r v e r .   T h e r e   a r e   s o m e   o t h e r   k u b e l e t   c o m m a n d   l i n e   p a r a m e t e r s   y o u   m a y   w a n t   t o   u s e : - - c l o u d - p r o v i d e r :   I f   y o u   a r e   u s i n g   - - c l o u d - p r o v i d e r = g c e ,   y o u   s h o u l d   r e m o v e   t h e   f l a g   t o   r u n   t h e   t e s t . R u n   t h e   n o d e   c o n f o r m a n c e   t e s t   w i t h   c o m m a n d : #   $ C O N F I G _ D I R   i s   t h e   p o d   m a n i f e s t   p a t h   o f   y o u r   k u b e l e t .   #   $ L O G _ D I R   i s   t h e   t e s t   o u t p u t   p a t h .   s u d o   d o c k e r   r u n   - i t   - - r m   - - p r i v i l e g e d   - - n e t = h o s t   \   - v   / : / r o o t f s   - v   $ C O N F I G _ D I R : $ C O N F I G _ D I R   - v   $ L O G _ D I R : / v a r / r e s u l t   \   r e g i s t r y . k 8 s . i o / n o d e - t e s t : 0 . 2   W o r k   o u t   t h e   v a l u e   o f   t h e   - - k u b e c o n f i g   o p t i o n   f o r   t h e   k u b e l e t ;   f o r   e x a m p l e :   - - k u b e c o n f i g = / v a r / l i b / k u b e l e t / c o n f i g . y a m l .   B e c a u s e   t h e   t e s t   f r a m e w o r k   s t a r t s   a   l o c a l   c o n t r o l   p l a n e   t o   t e s t   t h e   k u b e l e t ,   u s e   h t t p : / / l o c a l h o s t : 8 0 8 0   a s   t h e   U


Question: What is Running Node Conformance Test for Other Architectures?

Answer: K u b e r n e t e s   a l s o   p r o v i d e s   n o d e   c o n f o r m a n c e   t e s t   d o c k e r   i m a g e s   f o r   o t h e r   a r c h i t e c t u r e s :


Question: What is Running Selected Test?

Answer: T o   r u n   s p e c i f i c   t e s t s ,   o v e r w r i t e   t h e   e n v i r o n m e n t   v a r i a b l e   F O C U S   w i t h   t h e   r e g u l a r   e x p r e s s i o n   o f   t e s t s   y o u   w a n t   t o   r u n .   s u d o   d o c k e r   r u n   - i t   - - r m   - - p r i v i l e g e d   - - n e t = h o s t   \   - v   / : / r o o t f s : r o   - v   $ C O N F I G _ D I R : $ C O N F I G _ D I R   - v   $ L O G _ D I R : / v a r / r e s u l t   \   - e   F O C U S = M i r r o r P o d   \   #   O n l y   r u n   M i r r o r P o d   t e s t   r e g i s t r y . k 8 s . i o / n o d e - t e s t : 0 . 2   T o   s k i p   s p e c i f i c   t e s t s ,   o v e r w r i t 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 I P   w i t h   t h e   r e g u l a r   e x p r e s s i o n   o f   t e s t s   y o u   w a n t   t o   s k i p .   s u d o   d o c k e r   r u n   - i t   - - r m   - - p r i v i l e g e d   - - n e t = h o s t   \   - v   / : / r o o t f s : r o   - v   $ C O N F I G _ D I R : $ C O N F I G _ D I R   - v   $ L O G _ D I R : / v a r / r e s u l t   \   - e   S K I P = M i r r o r P o d   \   #   R u n   a l l   c o n f o r m a n c e   t e s t s   b u t   s k i p   M i r r o r P o d   t e s t   r e g i s t r y . k 8 s . i o / n o d e - t e s t : 0 . 2   N o d e   c o n f o r m a n c e   t e s t   i s   a   c o n t a i n e r i z e d   v e r s i o n   o f   n o d e   e 2 e   t e s t .   B y   d e f a u l t ,   i t   r u n s   a l l   c o n f o r m a n c e   t e s t s .   T h e o r e t i c a l l y ,   y o u   c a n   r u n   a n y   n o d e   e 2 e   t e s t   i f   y o u   c o n f i g u r e   t h e   c o n t a i n e r   a n d   m o u n t   r e q u i r e d   v o l u m e s   p r o p e r l y .   B u t   i t   i s   s t r o n g l y   r e c o m m e n d e d   t o   o n l y   r u n   c o n f o r m a n c e   t e s t ,   b e c a u s e   i t   r e q u i r e s   m u c h   m o r e   c o m p l e x   c o n f i g u r a t i o n   t o   r u n   n


Question: What is Caveats?

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


Question: What is Pod Hostname?

Answer: Pod HostnameThis page explains how to set a Pod's hostname, potential side effects after configuration, and the underlying mechanics.Default Pod hostnameWhen a Pod is created, its hostname (as observed from within the Pod) is derived from the Pod's metadata.name value. Both the hostname and its corresponding fully qualified domain name (FQDN) are set to the metadata.name value (from the Pod's perspective)apiVersion: v1 kind: Pod metadata: name: busybox-1 spec: containers: - image: busybox:1.28 command: - sleep - "3600" name: busybox The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.Hostname with pod's hostname and subdomain fieldsThe Pod spec includes an optional hostname field. When set, this value takes precedence over the Pod's metadata.name as the hostname (observed from within the Pod). For example, a Pod with spec.hostname set to my-host will have its hostname set to my-host.The Pod spec also includes an optional subdomain field, indicating the Pod belongs to a subdomain within its namespace. If a Pod has spec.hostname set to "foo" and spec.subdomain set to "bar" in the namespace my-namespace, its hostname becomes foo and its fully qualified domain name (FQDN) becomes foo.bar.my-namespace.svc.cluster-domain.example (observed from within the Pod).When both hostname and subdomain are set, the cluster's DNS server will create A and/or AAAA records based on these fields. Refer to: Pod's hostname and subdomain fields.Hostname with pod's setHostnameAsFQDN fieldsFEATURE STATE: Kubernetes v1.22 [stable]When a Pod is configured to have fully qualified domain name (FQDN), its hostname is the short hostname. For example, if you have a Pod with the fully qualified domain name busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example, then by default the hostname command inside that Pod returns busybox-1 and the hostname --fqdn command returns the FQDN.When both setHostnameAsFQDN: true and the subdomain field is set in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both hostname and hostname --fqdn return the Pod's FQDN.The Pod's FQDN is constructed in the same manner as previously defined. It is composed of the Pod's spec.hostname (if specified) or metadata.name field, the spec.subdomain, the namespace name, and the cluster domain suffix.Note:In Linux, the hostname field of the kernel (the nodename field of struct utsname) is limited to 64 characters.If a Pod enables this feature and its FQDN is longer than 64 character, it will fail to start. The Pod will remain in Pending status (ContainerCreating as seen by kubectl) generating error events, such as "Failed to construct FQDN from Pod hostname and cluster domain".This means that when using this field, you must ensure the combined length of the Pod's metadata.name (or spec.hostname) and spec.subdomain fields results in an FQDN that does not exceed 64 characters.Hostname wit


Question: How does Pod Hostname work?

Answer: Pod HostnameThis page explains how to set a Pod's hostname, potential side effects after configuration, and the underlying mechanics.Default Pod hostnameWhen a Pod is created, its hostname (as observed from within the Pod) is derived from the Pod's metadata.name value. Both the hostname and its corresponding fully qualified domain name (FQDN) are set to the metadata.name value (from the Pod's perspective)apiVersion: v1 kind: Pod metadata: name: busybox-1 spec: containers: - image: busybox:1.28 command: - sleep - "3600" name: busybox The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.Hostname with pod's hostname and subdomain fieldsThe Pod spec includes an optional hostname field. When set, this value takes precedence over the Pod's metadata.name as the hostname (observed from within the Pod). For example, a Pod with spec.hostname set to my-host will have its hostname set to my-host.The Pod spec also includes an optional subdomain field, indicating the Pod belongs to a subdomain within its namespace. If a Pod has spec.hostname set to "foo" and spec.subdomain set to "bar" in the namespace my-namespace, its hostname becomes foo and its fully qualified domain name (FQDN) becomes foo.bar.my-namespace.svc.cluster-domain.example (observed from within the Pod).When both hostname and subdomain are set, the cluster's DNS server will create A and/or AAAA records based on these fields. Refer to: Pod's hostname and subdomain fields.Hostname with pod's setHostnameAsFQDN fieldsFEATURE STATE: Kubernetes v1.22 [stable]When a Pod is configured to have fully qualified domain name (FQDN), its hostname is the short hostname. For example, if you have a Pod with the fully qualified domain name busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example, then by default the hostname command inside that Pod returns busybox-1 and the hostname --fqdn command returns the FQDN.When both setHostnameAsFQDN: true and the subdomain field is set in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both hostname and hostname --fqdn return the Pod's FQDN.The Pod's FQDN is constructed in the same manner as previously defined. It is composed of the Pod's spec.hostname (if specified) or metadata.name field, the spec.subdomain, the namespace name, and the cluster domain suffix.Note:In Linux, the hostname field of the kernel (the nodename field of struct utsname) is limited to 64 characters.If a Pod enables this feature and its FQDN is longer than 64 character, it will fail to start. The Pod will remain in Pending status (ContainerCreating as seen by kubectl) generating error events, such as "Failed to construct FQDN from Pod hostname and cluster domain".This means that when using this field, you must ensure the combined length of the Pod's metadata.name (or spec.hostname) and spec.subdomain fields results in an FQDN that does not exceed 64 characters.Hostname wit


Question: When would you use Pod Hostname?

Answer: Pod HostnameThis page explains how to set a Pod's hostname, potential side effects after configuration, and the underlying mechanics.Default Pod hostnameWhen a Pod is created, its hostname (as observed from within the Pod) is derived from the Pod's metadata.name value. Both the hostname and its corresponding fully qualified domain name (FQDN) are set to the metadata.name value (from the Pod's perspective)apiVersion: v1 kind: Pod metadata: name: busybox-1 spec: containers: - image: busybox:1.28 command: - sleep - "3600" name: busybox The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.Hostname with pod's hostname and subdomain fieldsThe Pod spec includes an optional hostname field. When set, this value takes precedence over the Pod's metadata.name as the hostname (observed from within the Pod). For example, a Pod with spec.hostname set to my-host will have its hostname set to my-host.The Pod spec also includes an optional subdomain field, indicating the Pod belongs to a subdomain within its namespace. If a Pod has spec.hostname set to "foo" and spec.subdomain set to "bar" in the namespace my-namespace, its hostname becomes foo and its fully qualified domain name (FQDN) becomes foo.bar.my-namespace.svc.cluster-domain.example (observed from within the Pod).When both hostname and subdomain are set, the cluster's DNS server will create A and/or AAAA records based on these fields. Refer to: Pod's hostname and subdomain fields.Hostname with pod's setHostnameAsFQDN fieldsFEATURE STATE: Kubernetes v1.22 [stable]When a Pod is configured to have fully qualified domain name (FQDN), its hostname is the short hostname. For example, if you have a Pod with the fully qualified domain name busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example, then by default the hostname command inside that Pod returns busybox-1 and the hostname --fqdn command returns the FQDN.When both setHostnameAsFQDN: true and the subdomain field is set in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both hostname and hostname --fqdn return the Pod's FQDN.The Pod's FQDN is constructed in the same manner as previously defined. It is composed of the Pod's spec.hostname (if specified) or metadata.name field, the spec.subdomain, the namespace name, and the cluster domain suffix.Note:In Linux, the hostname field of the kernel (the nodename field of struct utsname) is limited to 64 characters.If a Pod enables this feature and its FQDN is longer than 64 character, it will fail to start. The Pod will remain in Pending status (ContainerCreating as seen by kubectl) generating error events, such as "Failed to construct FQDN from Pod hostname and cluster domain".This means that when using this field, you must ensure the combined length of the Pod's metadata.name (or spec.hostname) and spec.subdomain fields results in an FQDN that does not exceed 64 characters.Hostname wit


Question: What are the benefits of Pod Hostname?

Answer: Pod HostnameThis page explains how to set a Pod's hostname, potential side effects after configuration, and the underlying mechanics.Default Pod hostnameWhen a Pod is created, its hostname (as observed from within the Pod) is derived from the Pod's metadata.name value. Both the hostname and its corresponding fully qualified domain name (FQDN) are set to the metadata.name value (from the Pod's perspective)apiVersion: v1 kind: Pod metadata: name: busybox-1 spec: containers: - image: busybox:1.28 command: - sleep - "3600" name: busybox The Pod created by this manifest will have its hostname and fully qualified domain name (FQDN) set to busybox-1.Hostname with pod's hostname and subdomain fieldsThe Pod spec includes an optional hostname field. When set, this value takes precedence over the Pod's metadata.name as the hostname (observed from within the Pod). For example, a Pod with spec.hostname set to my-host will have its hostname set to my-host.The Pod spec also includes an optional subdomain field, indicating the Pod belongs to a subdomain within its namespace. If a Pod has spec.hostname set to "foo" and spec.subdomain set to "bar" in the namespace my-namespace, its hostname becomes foo and its fully qualified domain name (FQDN) becomes foo.bar.my-namespace.svc.cluster-domain.example (observed from within the Pod).When both hostname and subdomain are set, the cluster's DNS server will create A and/or AAAA records based on these fields. Refer to: Pod's hostname and subdomain fields.Hostname with pod's setHostnameAsFQDN fieldsFEATURE STATE: Kubernetes v1.22 [stable]When a Pod is configured to have fully qualified domain name (FQDN), its hostname is the short hostname. For example, if you have a Pod with the fully qualified domain name busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example, then by default the hostname command inside that Pod returns busybox-1 and the hostname --fqdn command returns the FQDN.When both setHostnameAsFQDN: true and the subdomain field is set in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both hostname and hostname --fqdn return the Pod's FQDN.The Pod's FQDN is constructed in the same manner as previously defined. It is composed of the Pod's spec.hostname (if specified) or metadata.name field, the spec.subdomain, the namespace name, and the cluster domain suffix.Note:In Linux, the hostname field of the kernel (the nodename field of struct utsname) is limited to 64 characters.If a Pod enables this feature and its FQDN is longer than 64 character, it will fail to start. The Pod will remain in Pending status (ContainerCreating as seen by kubectl) generating error events, such as "Failed to construct FQDN from Pod hostname and cluster domain".This means that when using this field, you must ensure the combined length of the Pod's metadata.name (or spec.hostname) and spec.subdomain fields results in an FQDN that does not exceed 64 characters.Hostname wit


Question: What is Pod Hostname?

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


Question: What is Default Pod hostname?

Answer: W h e n   a   P o d   i s   c r e a t e d ,   i t s   h o s t n a m e   ( a s   o b s e r v e d   f r o m   w i t h i n   t h e   P o d )   i s   d e r i v e d   f r o m   t h e   P o d ' s   m e t a d a t a . n a m e   v a l u e .   B o t h   t h e   h o s t n a m e   a n d   i t s   c o r r e s p o n d i n g   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 )   a r e   s e t   t o   t h e   m e t a d a t a . n a m e   v a l u e   ( f r o m   t h e   P o d ' s   p e r s p e c t i v e )   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 :   b u s y b o x - 1   s p e c :   c o n t a i n e r s :   -   i m a g e :   b u s y b o x : 1 . 2 8   c o m m a n d :   -   s l e e p   -   " 3 6 0 0 "   n a m e :   b u s y b o x   T h e   P o d   c r e a t e d   b y   t h i s   m a n i f e s t   w i l l   h a v e   i t s   h o s t n a m e   a n d   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 )   s e t   t o   b u s y b o x - 1 .


Question: What is Hostname with pod's hostname and subdomain fields?

Answer: T h e   P o d   s p e c   i n c l u d e s   a n   o p t i o n a l   h o s t n a m e   f i e l d .   W h e n   s e t ,   t h i s   v a l u e   t a k e s   p r e c e d e n c e   o v e r   t h e   P o d ' s   m e t a d a t a . n a m e   a s   t h e   h o s t n a m e   ( o b s e r v e d   f r o m   w i t h i n   t h e   P o d ) .   F o r   e x a m p l e ,   a   P o d   w i t h   s p e c . h o s t n a m e   s e t   t o   m y - h o s t   w i l l   h a v e   i t s   h o s t n a m e   s e t   t o   m y - h o s t .   T h e   P o d   s p e c   a l s o   i n c l u d e s   a n   o p t i o n a l   s u b d o m a i n   f i e l d ,   i n d i c a t i n g   t h e   P o d   b e l o n g s   t o   a   s u b d o m a i n   w i t h i n   i t s   n a m e s p a c e .   I f   a   P o d   h a s   s p e c . h o s t n a m e   s e t   t o   " f o o "   a n d   s p e c . s u b d o m a i n   s e t   t o   " b a r "   i n   t h e   n a m e s p a c e   m y - n a m e s p a c e ,   i t s   h o s t n a m e   b e c o m e s   f o o   a n d   i t s   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 )   b e c o m e s   f o o . b a r . m y - n a m e s p a c e . s v c . c l u s t e r - d o m a i n . e x a m p l e   ( o b s e r v e d   f r o m   w i t h i n   t h e   P o d ) .   W h e n   b o t h   h o s t n a m e   a n d   s u b d o m a i n   a r e   s e t ,   t h e   c l u s t e r ' s   D N S   s e r v e r   w i l l   c r e a t e   A   a n d / o r   A A A A   r e c o r d s   b a s e d   o n   t h e s e   f i e l d s .   R e f e r   t o :   P o d ' s   h o s t n a m e   a n d   s u b d o m a i n   f i e l d s .


Question: What is Hostname with pod's setHostnameAsFQDN fields?

Answer: W h e n   a   P o d   i s   c o n f i g u r e d   t o   h a v 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 ) ,   i t s   h o s t n a m e   i s   t h e   s h o r t   h o s t n a m e .   F o r   e x a m p l e ,   i f   y o u   h a v e   a   P o d   w i t h   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   b u s y b o x - 1 . b u s y b o x - s u b d o m a i n . m y - n a m e s p a c e . s v c . c l u s t e r - d o m a i n . e x a m p l e ,   t h e n   b y   d e f a u l t   t h e   h o s t n a m e   c o m m a n d   i n s i d e   t h a t   P o d   r e t u r n s   b u s y b o x - 1   a n d   t h e   h o s t n a m e   - - f q d n   c o m m a n d   r e t u r n s   t h e   F Q D N .   W h e n   b o t h   s e t H o s t n a m e A s F Q D N :   t r u e   a n d   t h e   s u b d o m a i n   f i e l d   i s   s e t   i n   t h e   P o d   s p e c ,   t h e   k u b e l e t   w r i t e s   t h e   P o d ' s   F Q D N   i n t o   t h e   h o s t n a m e   f o r   t h a t   P o d ' s   n a m e s p a c e .   I n   t h i s   c a s e ,   b o t h   h o s t n a m e   a n d   h o s t n a m e   - - f q d n   r e t u r n   t h e   P o d ' s   F Q D N .   T h e   P o d ' s   F Q D N   i s   c o n s t r u c t e d   i n   t h e   s a m e   m a n n e r   a s   p r e v i o u s l y   d e f i n e d .   I t   i s   c o m p o s e d   o f   t h e   P o d ' s   s p e c . h o s t n a m e   ( i f   s p e c i f i e d )   o r   m e t a d a t a . n a m e   f i e l d ,   t h e   s p e c . s u b d o m a i n ,   t h e   n a m e s p a c e   n a m e ,   a n d   t h e   c l u s t e r   d o m a i n   s u f f i x .


Question: What is Note:?

Answer: I n   L i n u x ,   t h e   h o s t n a m e   f i e l d   o f   t h e   k e r n e l   ( t h e   n o d e n a m e   f i e l d   o f   s t r u c t   u t s n a m e )   i s   l i m i t e d   t o   6 4   c h a r a c t e r s .   I f   a   P o d   e n a b l e s   t h i s   f e a t u r e   a n d   i t s   F Q D N   i s   l o n g e r   t h a n   6 4   c h a r a c t e r ,   i t   w i l l   f a i l   t o   s t a r t .   T h e   P o d   w i l l   r e m a i n   i n   P e n d i n g   s t a t u s   ( C o n t a i n e r C r e a t i n g   a s   s e e n   b y   k u b e c t l )   g e n e r a t i n g   e r r o r   e v e n t s ,   s u c h   a s   " F a i l e d   t o   c o n s t r u c t   F Q D N   f r o m   P o d   h o s t n a m e   a n d   c l u s t e r   d o m a i n " .   T h i s   m e a n s   t h a t   w h e n   u s i n g   t h i s   f i e l d ,   y o u   m u s t   e n s u r e   t h e   c o m b i n e d   l e n g t h   o f   t h e   P o d ' s   m e t a d a t a . n a m e   ( o r   s p e c . h o s t n a m e )   a n d   s p e c . s u b d o m a i n   f i e l d s   r e s u l t s   i n   a n   F Q D N   t h a t   d o e s   n o t   e x c e e d   6 4   c h a r a c t e r s .


Question: What is Hostname with pod's hostnameOverride?

Answer: S e t t i n g   a   v a l u e   f o r   h o s t n a m e O v e r r i d e   i n   t h e   P o d   s p e c   c a u s e s   t h e   k u b e l e t   t o   u n c o n d i t i o n a l l y   s e t   b o t h   t h e   P o d ' s   h o s t n a m e   a n d   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 )   t o   t h e   h o s t n a m e O v e r r i d e   v a l u e .   T h e   h o s t n a m e O v e r r i d e   f i e l d   h a s   a   l e n g t h   l i m i t a t i o n   o f   6 4   c h a r a c t e r s   a n d   m u s t   a d h e r e   t o   t h e   D N S   s u b d o m a i n   n a m e s   s t a n d a r d   d e f i n e d   i n   R F C   1 1 2 3 .   E x a m p l e :   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 :   b u s y b o x - 2 - b u s y b o x - e x a m p l e - d o m a i n   s p e c :   h o s t n a m e O v e r r i d e :   b u s y b o x - 2 . b u s y b o x . e x a m p l e . d o m a i n   c o n t a i n e r s :   -   i m a g e :   b u s y b o x : 1 . 2 8   c o m m a n d :   -   s l e e p   -   " 3 6 0 0 "   n a m e :   b u s y b o x


Question: What is Note:?

Answer: I f   h o s t n a m e O v e r r i d e   i s   s e t   a l o n g s i d e   h o s t n a m e   a n d   s u b d o m a i n   f i e l d s :   T h e   h o s t n a m e   i n s i d e   t h e   P o d   i s   o v e r r i d d e n   t o   t h e   h o s t n a m e O v e r r i d e   v a l u e . T h e   P o d ' s   A   a n d / o r   A A A A   r e c o r d s   i n   t h e   c l u s t e r   D N S   s e r v e r   a r e   s t i l l   g e n e r a t e d   b a s e d   o n   t h e   h o s t n a m e   a n d   s u b d o m a i n   f i e l d s .   T h e   h o s t n a m e   i n s i d e   t h e   P o d   i s   o v e r r i d d e n   t o   t h e   h o s t n a m e O v e r r i d e   v a l u e .   T h e   P o d ' s   A   a n d / o r   A A A A   r e c o r d s   i n   t h e   c l u s t e r   D N S   s e r v e r   a r e   s t i l l   g e n e r a t e d   b a s e d   o n   t h e   h o s t n a m e   a n d   s u b d o m a i n   f i e l d s .   N o t e :   I f   h o s t n a m e O v e r r i d e   i s   s e t ,   y o u   c a n n o t   s i m u l t a n e o u s l y   s e t   t h e   h o s t N e t w o r k   a n d   s e t H o s t n a m e A s F Q D N   f i e l d s .   T h e   A P I   s e r v e r   w i l l   e x p l i c i t l y   r e j e c t   a n y   c r e a t e   r e q u e s t   a t t e m p t i n g   t h i s   c o m b i n a t i o n .   F o r   d e t a i l s   o n   b e h a v i o r   w h e n   h o s t n a m e O v e r r i d e   i s   s e t   i n   c o m b i n a t i o n   w i t h   o t h e r   f i e l d s   ( h o s t n a m e ,   s u b d o m a i n ,   s e t H o s t n a m e A s F Q D N ,   h o s t N e t w o r k ) ,   s e e   t h e   t a b l e   i n   t h e   K E P - 4 7 6 2   d e s i g n   d e t a i l s .


Question: What is Ingress?

Answer: IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.apiVersion: networking.k8s.io/v1import "k8s.io/api/networking/v1"IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.apiVersion: networking.k8s.io/v1kind: Ingressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressSpec)spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (IngressStatus)status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressSpecIngressSpec describes the Ingress the user wishes to exist.defaultBackend (IngressBackend)defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.ingressClassName (string)ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the kubernetes.io/ingress.class annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.rules ([]IngressRule)Atomic: will be replaced during a mergerules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.rules.host (string)host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The : delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may chan


Question: How does Ingress work?

Answer: IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.apiVersion: networking.k8s.io/v1import "k8s.io/api/networking/v1"IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.apiVersion: networking.k8s.io/v1kind: Ingressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressSpec)spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (IngressStatus)status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressSpecIngressSpec describes the Ingress the user wishes to exist.defaultBackend (IngressBackend)defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.ingressClassName (string)ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the kubernetes.io/ingress.class annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.rules ([]IngressRule)Atomic: will be replaced during a mergerules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.rules.host (string)host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The : delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may chan


Question: When would you use Ingress?

Answer: IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.apiVersion: networking.k8s.io/v1import "k8s.io/api/networking/v1"IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.apiVersion: networking.k8s.io/v1kind: Ingressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressSpec)spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (IngressStatus)status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressSpecIngressSpec describes the Ingress the user wishes to exist.defaultBackend (IngressBackend)defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.ingressClassName (string)ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the kubernetes.io/ingress.class annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.rules ([]IngressRule)Atomic: will be replaced during a mergerules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.rules.host (string)host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The : delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may chan


Question: What are the benefits of Ingress?

Answer: IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.apiVersion: networking.k8s.io/v1import "k8s.io/api/networking/v1"IngressIngress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.apiVersion: networking.k8s.io/v1kind: Ingressmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (IngressSpec)spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusstatus (IngressStatus)status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-statusIngressSpecIngressSpec describes the Ingress the user wishes to exist.defaultBackend (IngressBackend)defaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.ingressClassName (string)ingressClassName is the name of an IngressClass cluster resource. Ingress controller implementations use this field to know whether they should be serving this Ingress resource, by a transitive connection (controller -> IngressClass -> Ingress resource). Although the kubernetes.io/ingress.class annotation (simple constant name) was never formally defined, it was widely supported by Ingress controllers to create a direct binding between Ingress controller and Ingress resources. Newly created Ingress resources should prefer using the field. However, even though the annotation is officially deprecated, for backwards compatibility reasons, ingress controllers should still honor that annotation if present.rules ([]IngressRule)Atomic: will be replaced during a mergerules is a list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.rules.host (string)host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the "host" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the IP in the Spec of the parent Ingress. 2. The : delimiter is not respected because ports are not allowed. Currently the port of an Ingress is implicitly :80 for http and :443 for https. Both these may chan


Question: What is Ingress?

Answer: a p i V e r s i o n :   n e t w o r k i n g . k 8 s . i o / v 1   i m p o r t   " k 8 s . i o / a p i / n e t w o r k i n g / v 1 "


Question: What is Ingress?

Answer: I n g r e s s   i s   a   c o l l e c t i o n   o f   r u l e s   t h a t   a l l o w   i n b o u n d   c o n n e c t i o n s   t o   r e a c h   t h e   e n d p o i n t s   d e f i n e d   b y   a   b a c k e n d .   A n   I n g r e s s   c a n   b e   c o n f i g u r e d   t o   g i v e   s e r v i c e s   e x t e r n a l l y - r e a c h a b l e   u r l s ,   l o a d   b a l a n c e   t r a f f i c ,   t e r m i n a t e   S S L ,   o f f e r   n a m e   b a s e d   v i r t u a l   h o s t i n g   e t c .   a p i V e r s i o n :   n e t w o r k i n g . k 8 s . i o / v 1 k i n d :   I n g r e s s m e t a d a t a   ( O b j e c t M e t a ) S t a n d a r d   o b j e c t ' s   m e t a d a t a .   M o r e   i n f o :   h t t p s : / / g i t . k 8 s . i o / c o m m u n i t y / c o n t r i b u t o r s / d e v e l / s i g - a r c h i t e c t u r e / a p i - c o n v e n t i o n s . m d # m e t a d a t a s p e c   ( I n g r e s s S p e c ) s p e c   i s   t h e   d e s i r e d   s t a t e   o f   t h e   I n g r e s s .   M o r e   i n f o :   h t t p s : / / g i t . k 8 s . i o / c o m m u n i t y / c o n t r i b u t o r s / d e v e l / s i g - a r c h i t e c t u r e / a p i - c o n v e n t i o n s . m d # s p e c - a n d - s t a t u s s t a t u s   ( I n g r e s s S t a t u s ) s t a t u s   i s   t h e   c u r r e n t   s t a t e   o f   t h e   I n g r e s s .   M o r e   i n f o :   h t t p s : / / g i t . k 8 s . i o / c o m m u n i t y / c o n t r i b u t o r s / d e v e l / s i g - a r c h i t e c t u r e / a p i - c o n v e n t i o n s . m d # s p e c - a n d - s t a t u s   a p i V e r s i o n :   n e t w o r k i n g . k 8 s . i o / v 1   k i n d :   I n g r e s s   m e t a d a t a   ( O b j e c t M e t a )   S t a n d a r d   o b j e c t ' s   m e t a d a t a .   M o r e   i n f o :   h t t p s : / / g i t . k 8 s . i o / c o m m u n i t y / c o n t r i b u t o r s / d e v e l / s i g - a r c h i t e c t u r e / a p i - c o n v e n t i o n s . m d # m e t a d a t


Question: What is IngressSpec?

Answer: I n g r e s s S p e c   d e s c r i b e s   t h e   I n g r e s s   t h e   u s e r   w i s h e s   t o   e x i s t .   d e f a u l t B a c k e n d   ( I n g r e s s B a c k e n d ) d e f a u l t B a c k e n d   i s   t h e   b a c k e n d   t h a t   s h o u l d   h a n d l e   r e q u e s t s   t h a t   d o n ' t   m a t c h   a n y   r u l e .   I f   R u l e s   a r e   n o t   s p e c i f i e d ,   D e f a u l t B a c k e n d   m u s t   b e   s p e c i f i e d .   I f   D e f a u l t B a c k e n d   i s   n o t   s e t ,   t h e   h a n d l i n g   o f   r e q u e s t s   t h a t   d o   n o t   m a t c h   a n y   o f   t h e   r u l e s   w i l l   b e   u p   t o   t h e   I n g r e s s   c o n t r o l l e r . i n g r e s s C l a s s N a m e   ( s t r i n g ) i n g r e s s C l a s s N a m e   i s   t h e   n a m e   o f   a n   I n g r e s s C l a s s   c l u s t e r   r e s o u r c e .   I n g r e s s   c o n t r o l l e r   i m p l e m e n t a t i o n s   u s e   t h i s   f i e l d   t o   k n o w   w h e t h e r   t h e y   s h o u l d   b e   s e r v i n g   t h i s   I n g r e s s   r e s o u r c e ,   b y   a   t r a n s i t i v e   c o n n e c t i o n   ( c o n t r o l l e r   - >   I n g r e s s C l a s s   - >   I n g r e s s   r e s o u r c e ) .   A l t h o u g h   t h e   k u b e r n e t e s . i o / i n g r e s s . c l a s s   a n n o t a t i o n   ( s i m p l e   c o n s t a n t   n a m e )   w a s   n e v e r   f o r m a l l y   d e f i n e d ,   i t   w a s   w i d e l y   s u p p o r t e d   b y   I n g r e s s   c o n t r o l l e r s   t o   c r e a t e   a   d i r e c t   b i n d i n g   b e t w e e n   I n g r e s s   c o n t r o l l e r   a n d   I n g r e s s   r e s o u r c e s .   N e w l y   c r e a t e d   I n g r e s s   r e s o u r c e s   s h o u l d   p r e f e r   u s i n g   t h e   f i e l d .   H o w e v e r ,   e v e n   t h o u g h   t h e   a n n o t a t i o n   i s   o f f i c i a l l y   d e p r e c a t e d ,   f o r