Question: What is Configure Minimum and Maximum Memory Constraints for a Namespace?

Answer: Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for memory used by containers running in a namespace. You specify minimum and maximum memory values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory available for Pods.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-mem-example Create a LimitRange and a PodHere's an example manifest for a LimitRange:admin/resource/memory-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-min-max-demo-lr spec: limits: - max: memory: 1Gi min: memory: 500Mi type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example View detailed information about the LimitRange:kubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically. limits: - default: memory: 1Gi defaultRequest: memory: 1Gi max: memory: 1Gi min: memory: 500Mi type: Container Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes performs these steps:If any container in that Pod does not specify its own memory request and limit, the control plane assigns the default memory request and limit to that container.Verify that every container in that Pod requests at least 500 MiB of memory.Verify that every container in that Pod requests no more than 1024 MiB (1 GiB) of memory.Here's a manifest for a Pod that has one container. Within the Pod spec, the sole container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the minimum and maximum memory constraints imposed by the LimitRange.admin/resource/memory-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-mem-demo spec: containers: - name: constraints-mem-demo-ctr image: nginx resources: limits: memory: "800Mi" requests: memory: "600Mi


Question: How does Configure Minimum and Maximum Memory Constraints for a Namespace work?

Answer: Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for memory used by containers running in a namespace. You specify minimum and maximum memory values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory available for Pods.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-mem-example Create a LimitRange and a PodHere's an example manifest for a LimitRange:admin/resource/memory-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-min-max-demo-lr spec: limits: - max: memory: 1Gi min: memory: 500Mi type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example View detailed information about the LimitRange:kubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically. limits: - default: memory: 1Gi defaultRequest: memory: 1Gi max: memory: 1Gi min: memory: 500Mi type: Container Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes performs these steps:If any container in that Pod does not specify its own memory request and limit, the control plane assigns the default memory request and limit to that container.Verify that every container in that Pod requests at least 500 MiB of memory.Verify that every container in that Pod requests no more than 1024 MiB (1 GiB) of memory.Here's a manifest for a Pod that has one container. Within the Pod spec, the sole container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the minimum and maximum memory constraints imposed by the LimitRange.admin/resource/memory-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-mem-demo spec: containers: - name: constraints-mem-demo-ctr image: nginx resources: limits: memory: "800Mi" requests: memory: "600Mi


Question: When would you use Configure Minimum and Maximum Memory Constraints for a Namespace?

Answer: Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for memory used by containers running in a namespace. You specify minimum and maximum memory values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory available for Pods.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-mem-example Create a LimitRange and a PodHere's an example manifest for a LimitRange:admin/resource/memory-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-min-max-demo-lr spec: limits: - max: memory: 1Gi min: memory: 500Mi type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example View detailed information about the LimitRange:kubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically. limits: - default: memory: 1Gi defaultRequest: memory: 1Gi max: memory: 1Gi min: memory: 500Mi type: Container Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes performs these steps:If any container in that Pod does not specify its own memory request and limit, the control plane assigns the default memory request and limit to that container.Verify that every container in that Pod requests at least 500 MiB of memory.Verify that every container in that Pod requests no more than 1024 MiB (1 GiB) of memory.Here's a manifest for a Pod that has one container. Within the Pod spec, the sole container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the minimum and maximum memory constraints imposed by the LimitRange.admin/resource/memory-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-mem-demo spec: containers: - name: constraints-mem-demo-ctr image: nginx resources: limits: memory: "800Mi" requests: memory: "600Mi


Question: What are the benefits of Configure Minimum and Maximum Memory Constraints for a Namespace?

Answer: Configure Minimum and Maximum Memory Constraints for a NamespaceDefine a range of valid memory resource limits for a namespace, so that every new Pod in that namespace falls within the range you configure.This page shows how to set minimum and maximum values for memory used by containers running in a namespace. You specify minimum and maximum memory values in a LimitRange object. If a Pod does not meet the constraints imposed by the LimitRange, it cannot be created in the namespace.Before you beginYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou must have access to create namespaces in your cluster.Each node in your cluster must have at least 1 GiB of memory available for Pods.Create a namespaceCreate a namespace so that the resources you create in this exercise are isolated from the rest of your cluster.kubectl create namespace constraints-mem-example Create a LimitRange and a PodHere's an example manifest for a LimitRange:admin/resource/memory-constraints.yaml apiVersion: v1 kind: LimitRange metadata: name: mem-min-max-demo-lr spec: limits: - max: memory: 1Gi min: memory: 500Mi type: Container Create the LimitRange:kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints.yaml --namespace=constraints-mem-example View detailed information about the LimitRange:kubectl get limitrange mem-min-max-demo-lr --namespace=constraints-mem-example --output=yaml The output shows the minimum and maximum memory constraints as expected. But notice that even though you didn't specify default values in the configuration file for the LimitRange, they were created automatically. limits: - default: memory: 1Gi defaultRequest: memory: 1Gi max: memory: 1Gi min: memory: 500Mi type: Container Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes performs these steps:If any container in that Pod does not specify its own memory request and limit, the control plane assigns the default memory request and limit to that container.Verify that every container in that Pod requests at least 500 MiB of memory.Verify that every container in that Pod requests no more than 1024 MiB (1 GiB) of memory.Here's a manifest for a Pod that has one container. Within the Pod spec, the sole container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the minimum and maximum memory constraints imposed by the LimitRange.admin/resource/memory-constraints-pod.yaml apiVersion: v1 kind: Pod metadata: name: constraints-mem-demo spec: containers: - name: constraints-mem-demo-ctr image: nginx resources: limits: memory: "800Mi" requests: memory: "600Mi


Question: What is Configure Minimum and Maximum Memory Constraints for a Namespace?

Answer: T h i s   p a g e   s h o w s   h o w   t o   s e t   m i n i m u m   a n d   m a x i m u m   v a l u e s   f o r   m e m o r y   u s e d   b y   c o n t a i n e r s   r u n n i n g   i n   a   n a m e s p a c e .   Y o u   s p e c i f y   m i n i m u m   a n d   m a x i m u m   m e m o r y   v a l u e s   i n   a   L i m i t R a n g e   o b j e c t .   I f   a   P o d   d o e s   n o t   m e e t   t h e   c o n s t r a i n t s   i m p o s e d   b y   t h e   L i m i t R a n g e ,   i t   c a n n o t   b e   c r e a t e d   i n   t h e   n a m e s p a c e .


Question: What is Before you begin?

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


Question: What is Create a namespace?

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


Question: What is Create a LimitRange and a Pod?

Answer: H e r e ' s   a n   e x a m p l e   m a n i f e s t   f o r   a   L i m i t R a n g e :   a p i V e r s i o n :   v 1   k i n d :   L i m i t R a n g e   m e t a d a t a :   n a m e :   m e m - m i n - m a x - d e m o - l r   s p e c :   l i m i t s :   -   m a x :   m e m o r y :   1 G i   m i n :   m e m o r y :   5 0 0 M i   t y p e :   C o n t a i n e r   C r e a t e   t h e   L i m i t R a n g e :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - c o n s t r a i n t s . y a m l   - - n a m e s p a c e = c o n s t r a i n t s - m e m - e x a m p l e   V i e w   d e t a i l e d   i n f o r m a t i o n   a b o u t   t h e   L i m i t R a n g e :   k u b e c t l   g e t   l i m i t r a n g e   m e m - m i n - m a x - d e m o - l r   - - n a m e s p a c e = c o n s t r a i n t s - m e m - e x a m p l e   - - o u t p u t = y a m l   T h e   o u t p u t   s h o w s   t h e   m i n i m u m   a n d   m a x i m u m   m e m o r y   c o n s t r a i n t s   a s   e x p e c t e d .   B u t   n o t i c e   t h a t   e v e n   t h o u g h   y o u   d i d n ' t   s p e c i f y   d e f a u l t   v a l u e s   i n   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   L i m i t R a n g e ,   t h e y   w e r e   c r e a t e d   a u t o m a t i c a l l y .   l i m i t s :   -   d e f a u l t :   m e m o r y :   1 G i   d e f a u l t R e q u e s t :   m e m o r y :   1 G i   m a x :   m e m o r y :   1 G i   m i n :   m e m o r y :   5 0 0 M i   t y p e :   C o n t a i n e r   N o w   w h e n e v e r   y o u   d e f i n e   a   P o d   w i t h i n   t h e   c o n s t r a i n t s - m e m - e x a m p l e   n a m e s p a c e ,   K u b e r n e t e s   p e r f o r m s   t h e s e   s t e p s :   I f   a n y   c o n t a i n e r   i n   t h a t   P o d   d o e s   n o t   s p e c i f y   i t s   o w n   m e m o r y   r e q u e s t   a n d   l i m i t ,   t h e   c o n t r o l   p l a n e   a s s i g n s


Question: What is Attempt to create a Pod that exceeds the maximum memory constraint?

Answer: H e r e ' s   a   m a n i f e s t   f o r   a   P o d   t h a t   h a s   o n e   c o n t a i n e r .   T h e   c o n t a i n e r   s p e c i f i e s   a   m e m o r y   r e q u e s t   o f   8 0 0   M i B   a n d   a   m e m o r y   l i m i t   o f   1 . 5   G i B .   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 :   c o n s t r a i n t s - m e m - d e m o - 2   s p e c :   c o n t a i n e r s :   -   n a m e :   c o n s t r a i n t s - m e m - d e m o - 2 - c t r   i m a g e :   n g i n x   r e s o u r c e s :   l i m i t s :   m e m o r y :   " 1 . 5 G i "   r e q u e s t s :   m e m o r y :   " 8 0 0 M i "   A t t e m p t   t o   c r e a t e   t h e   P o d :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - c o n s t r a i n t s - p o d - 2 . y a m l   - - n a m e s p a c e = c o n s t r a i n t s - m e m - e x a m p l e   T h e   o u t p u t   s h o w s   t h a t   t h e   P o d   d o e s   n o t   g e t   c r e a t e d ,   b e c a u s e   i t   d e f i n e s   a   c o n t a i n e r   t h a t   r e q u e s t s   m o r e   m e m o r y   t h a n   i s   a l l o w e d :   E r r o r   f r o m   s e r v e r   ( F o r b i d d e n ) :   e r r o r   w h e n   c r e a t i n g   " e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - c o n s t r a i n t s - p o d - 2 . y a m l " :   p o d s   " c o n s t r a i n t s - m e m - d e m o - 2 "   i s   f o r b i d d e n :   m a x i m u m   m e m o r y   u s a g e   p e r   C o n t a i n e r   i s   1 G i ,   b u t   l i m i t   i s   1 5 3 6 M i .


Question: What is Attempt to create a Pod that does not meet the minimum memory request?

Answer: H e r e ' s   a   m a n i f e s t   f o r   a   P o d   t h a t   h a s   o n e   c o n t a i n e r .   T h a t   c o n t a i n e r   s p e c i f i e s   a   m e m o r y   r e q u e s t   o f   1 0 0   M i B   a n d   a   m e m o r y   l i m i t   o f   8 0 0   M i B .   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 :   c o n s t r a i n t s - m e m - d e m o - 3   s p e c :   c o n t a i n e r s :   -   n a m e :   c o n s t r a i n t s - m e m - d e m o - 3 - c t r   i m a g e :   n g i n x   r e s o u r c e s :   l i m i t s :   m e m o r y :   " 8 0 0 M i "   r e q u e s t s :   m e m o r y :   " 1 0 0 M i "   A t t e m p t   t o   c r e a t e   t h e   P o d :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - c o n s t r a i n t s - p o d - 3 . y a m l   - - n a m e s p a c e = c o n s t r a i n t s - m e m - e x a m p l e   T h e   o u t p u t   s h o w s   t h a t   t h e   P o d   d o e s   n o t   g e t   c r e a t e d ,   b e c a u s e   i t   d e f i n e s   a   c o n t a i n e r   t h a t   r e q u e s t s   l e s s   m e m o r y   t h a n   t h e   e n f o r c e d   m i n i m u m :   E r r o r   f r o m   s e r v e r   ( F o r b i d d e n ) :   e r r o r   w h e n   c r e a t i n g   " e x a m p l e s / a d m i n / r e s o u r c e / m e m o r y - c o n s t r a i n t s - p o d - 3 . y a m l " :   p o d s   " c o n s t r a i n t s - m e m - d e m o - 3 "   i s   f o r b i d d e n :   m i n i m u m   m e m o r y   u s a g e   p e r   C o n t a i n e r   i s   5 0 0 M i ,   b u t   r e q u e s t   i s   1 0 0 M i .


Question: What is Create a Pod that does not specify any memory request or limit?

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


Question: What is Enforcement of minimum and maximum memory constraints?

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


Question: What is Motivation for minimum and maximum memory constraints?

Answer: A s   a   c l u s t e r   a d m i n i s t r a t o r ,   y o u   m i g h t   w a n t   t o   i m p o s e   r e s t r i c t i o n s   o n   t h e   a m o u n t   o f   m e m o r y   t h a t   P o d s   c a n   u s e .   F o r   e x a m p l e :   E a c h   N o d e   i n   a   c l u s t e r   h a s   2   G i B   o f   m e m o r y .   Y o u   d o   n o t   w a n t   t o   a c c e p t   a n y   P o d   t h a t   r e q u e s t s   m o r e   t h a n   2   G i B   o f   m e m o r y ,   b e c a u s e   n o   N o d e   i n   t h e   c l u s t e r   c a n   s u p p o r t   t h e   r e q u e s t . A   c l u s t e r   i s   s h a r e d   b y   y o u r   p r o d u c t i o n   a n d   d e v e l o p m e n t   d e p a r t m e n t s .   Y o u   w a n t   t o   a l l o w   p r o d u c t i o n   w o r k l o a d s   t o   c o n s u m e   u p   t o   8   G i B   o f   m e m o r y ,   b u t   y o u   w a n t   d e v e l o p m e n t   w o r k l o a d s   t o   b e   l i m i t e d   t o   5 1 2   M i B .   Y o u   c r e a t e   s e p a r a t e   n a m e s p a c e s   f o r   p r o d u c t i o n   a n d   d e v e l o p m e n t ,   a n d   y o u   a p p l y   m e m o r y   c o n s t r a i n t s   t o   e a c h   n a m e s p a c e .   E a c h   N o d e   i n   a   c l u s t e r   h a s   2   G i B   o f   m e m o r y .   Y o u   d o   n o t   w a n t   t o   a c c e p t   a n y   P o d   t h a t   r e q u e s t s   m o r e   t h a n   2   G i B   o f   m e m o r y ,   b e c a u s e   n o   N o d e   i n   t h e   c l u s t e r   c a n   s u p p o r t   t h e   r e q u e s t .   A   c l u s t e r   i s   s h a r e d   b y   y o u r   p r o d u c t i o n   a n d   d e v e l o p m e n t   d e p a r t m e n t s .   Y o u   w a n t   t o   a l l o w   p r o d u c t i o n   w o r k l o a d s   t o   c o n s u m e   u p   t o   8   G i B   o f   m e m o r y ,   b u t   y o u   w a n t   d e v e l o p m e n t   w o r k l o a d s   t o   b e   l i m i t e d   t o   5 1 2   M i B .   Y o u   c r e a t e


Question: What is Clean up?

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


Question: What is For cluster administrators?

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


Question: What is For app developers?

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


Question: What is Running ZooKeeper, A Distributed System Coordinator?

Answer: Running ZooKeeper, A Distributed System CoordinatorThis tutorial demonstrates running Apache Zookeeper on Kubernetes using StatefulSets, PodDisruptionBudgets, and PodAntiAffinity.Before you beginBefore starting this tutorial, you should be familiar with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningStatefulSetsPodDisruptionBudgetsPodAntiAffinitykubectl CLIYou must have a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. In this tutorial you will cordon and drain the cluster's nodes. This means that the cluster will terminate and evict all Pods on its nodes, and the nodes will temporarily become unschedulable. You should use a dedicated cluster for this tutorial, or you should ensure that the disruption you cause will not interfere with other tenants.This tutorial assumes that you have configured your cluster to dynamically provision PersistentVolumes. If your cluster is not configured to do so, you will have to manually provision three 20 GiB volumes before starting this tutorial.ObjectivesAfter this tutorial, you will know the following.How to deploy a ZooKeeper ensemble using StatefulSet.How to consistently configure the ensemble.How to spread the deployment of ZooKeeper servers in the ensemble.How to use PodDisruptionBudgets to ensure service availability during planned maintenance.ZooKeeperApache ZooKeeper is a distributed, open-source coordination service for distributed applications. ZooKeeper allows you to read, write, and observe updates to data. Data are organized in a file system like hierarchy and replicated to all ZooKeeper servers in the ensemble (a set of ZooKeeper servers). All operations on data are atomic and sequentially consistent. ZooKeeper ensures this by using the Zab consensus protocol to replicate a state machine across all servers in the ensemble.The ensemble uses the Zab protocol to elect a leader, and the ensemble cannot write data until that election is complete. Once complete, the ensemble uses Zab to ensure that it replicates all writes to a quorum before it acknowledges and makes them visible to clients. Without respect to weighted quorums, a quorum is a majority component of the ensemble containing the current leader. For instance, if the ensemble has three servers, a component that contains the leader and one other server constitutes a quorum. If the ensemble can not achieve a quorum, the ensemble cannot write data.ZooKeeper servers keep their entire state machine in memory, and write every mutation to a durable WAL (Write Ahead Log) on storage media. When a server crashes, it can recover its previous state by replaying the WAL. To prevent the WAL from growing without bound, ZooKeeper servers will periodically snapshot them in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be discarded.Creating a ZooKeeper ensembleThe ma


Question: How does Running ZooKeeper, A Distributed System Coordinator work?

Answer: Running ZooKeeper, A Distributed System CoordinatorThis tutorial demonstrates running Apache Zookeeper on Kubernetes using StatefulSets, PodDisruptionBudgets, and PodAntiAffinity.Before you beginBefore starting this tutorial, you should be familiar with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningStatefulSetsPodDisruptionBudgetsPodAntiAffinitykubectl CLIYou must have a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. In this tutorial you will cordon and drain the cluster's nodes. This means that the cluster will terminate and evict all Pods on its nodes, and the nodes will temporarily become unschedulable. You should use a dedicated cluster for this tutorial, or you should ensure that the disruption you cause will not interfere with other tenants.This tutorial assumes that you have configured your cluster to dynamically provision PersistentVolumes. If your cluster is not configured to do so, you will have to manually provision three 20 GiB volumes before starting this tutorial.ObjectivesAfter this tutorial, you will know the following.How to deploy a ZooKeeper ensemble using StatefulSet.How to consistently configure the ensemble.How to spread the deployment of ZooKeeper servers in the ensemble.How to use PodDisruptionBudgets to ensure service availability during planned maintenance.ZooKeeperApache ZooKeeper is a distributed, open-source coordination service for distributed applications. ZooKeeper allows you to read, write, and observe updates to data. Data are organized in a file system like hierarchy and replicated to all ZooKeeper servers in the ensemble (a set of ZooKeeper servers). All operations on data are atomic and sequentially consistent. ZooKeeper ensures this by using the Zab consensus protocol to replicate a state machine across all servers in the ensemble.The ensemble uses the Zab protocol to elect a leader, and the ensemble cannot write data until that election is complete. Once complete, the ensemble uses Zab to ensure that it replicates all writes to a quorum before it acknowledges and makes them visible to clients. Without respect to weighted quorums, a quorum is a majority component of the ensemble containing the current leader. For instance, if the ensemble has three servers, a component that contains the leader and one other server constitutes a quorum. If the ensemble can not achieve a quorum, the ensemble cannot write data.ZooKeeper servers keep their entire state machine in memory, and write every mutation to a durable WAL (Write Ahead Log) on storage media. When a server crashes, it can recover its previous state by replaying the WAL. To prevent the WAL from growing without bound, ZooKeeper servers will periodically snapshot them in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be discarded.Creating a ZooKeeper ensembleThe ma


Question: When would you use Running ZooKeeper, A Distributed System Coordinator?

Answer: Running ZooKeeper, A Distributed System CoordinatorThis tutorial demonstrates running Apache Zookeeper on Kubernetes using StatefulSets, PodDisruptionBudgets, and PodAntiAffinity.Before you beginBefore starting this tutorial, you should be familiar with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningStatefulSetsPodDisruptionBudgetsPodAntiAffinitykubectl CLIYou must have a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. In this tutorial you will cordon and drain the cluster's nodes. This means that the cluster will terminate and evict all Pods on its nodes, and the nodes will temporarily become unschedulable. You should use a dedicated cluster for this tutorial, or you should ensure that the disruption you cause will not interfere with other tenants.This tutorial assumes that you have configured your cluster to dynamically provision PersistentVolumes. If your cluster is not configured to do so, you will have to manually provision three 20 GiB volumes before starting this tutorial.ObjectivesAfter this tutorial, you will know the following.How to deploy a ZooKeeper ensemble using StatefulSet.How to consistently configure the ensemble.How to spread the deployment of ZooKeeper servers in the ensemble.How to use PodDisruptionBudgets to ensure service availability during planned maintenance.ZooKeeperApache ZooKeeper is a distributed, open-source coordination service for distributed applications. ZooKeeper allows you to read, write, and observe updates to data. Data are organized in a file system like hierarchy and replicated to all ZooKeeper servers in the ensemble (a set of ZooKeeper servers). All operations on data are atomic and sequentially consistent. ZooKeeper ensures this by using the Zab consensus protocol to replicate a state machine across all servers in the ensemble.The ensemble uses the Zab protocol to elect a leader, and the ensemble cannot write data until that election is complete. Once complete, the ensemble uses Zab to ensure that it replicates all writes to a quorum before it acknowledges and makes them visible to clients. Without respect to weighted quorums, a quorum is a majority component of the ensemble containing the current leader. For instance, if the ensemble has three servers, a component that contains the leader and one other server constitutes a quorum. If the ensemble can not achieve a quorum, the ensemble cannot write data.ZooKeeper servers keep their entire state machine in memory, and write every mutation to a durable WAL (Write Ahead Log) on storage media. When a server crashes, it can recover its previous state by replaying the WAL. To prevent the WAL from growing without bound, ZooKeeper servers will periodically snapshot them in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be discarded.Creating a ZooKeeper ensembleThe ma


Question: What are the benefits of Running ZooKeeper, A Distributed System Coordinator?

Answer: Running ZooKeeper, A Distributed System CoordinatorThis tutorial demonstrates running Apache Zookeeper on Kubernetes using StatefulSets, PodDisruptionBudgets, and PodAntiAffinity.Before you beginBefore starting this tutorial, you should be familiar with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningStatefulSetsPodDisruptionBudgetsPodAntiAffinitykubectl CLIYou must have a cluster with at least four nodes, and each node requires at least 2 CPUs and 4 GiB of memory. In this tutorial you will cordon and drain the cluster's nodes. This means that the cluster will terminate and evict all Pods on its nodes, and the nodes will temporarily become unschedulable. You should use a dedicated cluster for this tutorial, or you should ensure that the disruption you cause will not interfere with other tenants.This tutorial assumes that you have configured your cluster to dynamically provision PersistentVolumes. If your cluster is not configured to do so, you will have to manually provision three 20 GiB volumes before starting this tutorial.ObjectivesAfter this tutorial, you will know the following.How to deploy a ZooKeeper ensemble using StatefulSet.How to consistently configure the ensemble.How to spread the deployment of ZooKeeper servers in the ensemble.How to use PodDisruptionBudgets to ensure service availability during planned maintenance.ZooKeeperApache ZooKeeper is a distributed, open-source coordination service for distributed applications. ZooKeeper allows you to read, write, and observe updates to data. Data are organized in a file system like hierarchy and replicated to all ZooKeeper servers in the ensemble (a set of ZooKeeper servers). All operations on data are atomic and sequentially consistent. ZooKeeper ensures this by using the Zab consensus protocol to replicate a state machine across all servers in the ensemble.The ensemble uses the Zab protocol to elect a leader, and the ensemble cannot write data until that election is complete. Once complete, the ensemble uses Zab to ensure that it replicates all writes to a quorum before it acknowledges and makes them visible to clients. Without respect to weighted quorums, a quorum is a majority component of the ensemble containing the current leader. For instance, if the ensemble has three servers, a component that contains the leader and one other server constitutes a quorum. If the ensemble can not achieve a quorum, the ensemble cannot write data.ZooKeeper servers keep their entire state machine in memory, and write every mutation to a durable WAL (Write Ahead Log) on storage media. When a server crashes, it can recover its previous state by replaying the WAL. To prevent the WAL from growing without bound, ZooKeeper servers will periodically snapshot them in memory state to storage media. These snapshots can be loaded directly into memory, and all WAL entries that preceded the snapshot may be discarded.Creating a ZooKeeper ensembleThe ma


Question: What is Running ZooKeeper, A Distributed System Coordinator?

Answer: T h i s   t u t o r i a l   d e m o n s t r a t e s   r u n n i n g   A p a c h e   Z o o k e e p e r   o n   K u b e r n e t e s   u s i n g   S t a t e f u l S e t s ,   P o d D i s r u p t i o n B u d g e t s ,   a n d   P o d A n t i A f f i n i t y .


Question: What is Before you begin?

Answer: B e f o r e   s t a r t i n g   t h i s   t u t o r i a l ,   y o u   s h o u l d   b e   f a m i l i a r   w i t h   t h e   f o l l o w i n g   K u b e r n e t e s   c o n c e p t s :   P o d s C l u s t e r   D N S H e a d l e s s   S e r v i c e s P e r s i s t e n t V o l u m e s P e r s i s t e n t V o l u m e   P r o v i s i o n i n g S t a t e f u l S e t s P o d D i s r u p t i o n B u d g e t s P o d A n t i A f f i n i t y k u b e c t l   C L I   Y o u   m u s t   h a v e   a   c l u s t e r   w i t h   a t   l e a s t   f o u r   n o d e s ,   a n d   e a c h   n o d e   r e q u i r e s   a t   l e a s t   2   C P U s   a n d   4   G i B   o f   m e m o r y .   I n   t h i s   t u t o r i a l   y o u   w i l l   c o r d o n   a n d   d r a i n   t h e   c l u s t e r ' s   n o d e s .   T h i s   m e a n s   t h a t   t h e   c l u s t e r   w i l l   t e r m i n a t e   a n d   e v i c t   a l l   P o d s   o n   i t s   n o d e s ,   a n d   t h e   n o d e s   w i l l   t e m p o r a r i l y   b e c o m e   u n s c h e d u l a b l e .   Y o u   s h o u l d   u s e   a   d e d i c a t e d   c l u s t e r   f o r   t h i s   t u t o r i a l ,   o r   y o u   s h o u l d   e n s u r e   t h a t   t h e   d i s r u p t i o n   y o u   c a u s e   w i l l   n o t   i n t e r f e r e   w i t h   o t h e r   t e n a n t s .   T h i s   t u t o r i a l   a s s u m e s   t h a t   y o u   h a v e   c o n f i g u r e d   y o u r   c l u s t e r   t o   d y n a m i c a l l y   p r o v i s i o n   P e r s i s t e n t V o l u m e s .   I f   y o u r   c l u s t e r   i s   n o t   c o n f i g u r e d   t o   d o   s o ,   y o u   w i l l   h a v e   t o   m a n u a l l y   p r o v i s i o n   t h r e e   2 0   G i B   v o l u m e s   b e f o r e   s t a r t i n g   t h i s   t u t o r i a l .


Question: What is Objectives?

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


Question: What is ZooKeeper?

Answer: A p a c h e   Z o o K e e p e r   i s   a   d i s t r i b u t e d ,   o p e n - s o u r c e   c o o r d i n a t i o n   s e r v i c e   f o r   d i s t r i b u t e d   a p p l i c a t i o n s .   Z o o K e e p e r   a l l o w s   y o u   t o   r e a d ,   w r i t e ,   a n d   o b s e r v e   u p d a t e s   t o   d a t a .   D a t a   a r e   o r g a n i z e d   i n   a   f i l e   s y s t e m   l i k e   h i e r a r c h y   a n d   r e p l i c a t e d   t o   a l l   Z o o K e e p e r   s e r v e r s   i n   t h e   e n s e m b l e   ( a   s e t   o f   Z o o K e e p e r   s e r v e r s ) .   A l l   o p e r a t i o n s   o n   d a t a   a r e   a t o m i c   a n d   s e q u e n t i a l l y   c o n s i s t e n t .   Z o o K e e p e r   e n s u r e s   t h i s   b y   u s i n g   t h e   Z a b   c o n s e n s u s   p r o t o c o l   t o   r e p l i c a t e   a   s t a t e   m a c h i n e   a c r o s s   a l l   s e r v e r s   i n   t h e   e n s e m b l e .   T h e   e n s e m b l e   u s e s   t h e   Z a b   p r o t o c o l   t o   e l e c t   a   l e a d e r ,   a n d   t h e   e n s e m b l e   c a n n o t   w r i t e   d a t a   u n t i l   t h a t   e l e c t i o n   i s   c o m p l e t e .   O n c e   c o m p l e t e ,   t h e   e n s e m b l e   u s e s   Z a b   t o   e n s u r e   t h a t   i t   r e p l i c a t e s   a l l   w r i t e s   t o   a   q u o r u m   b e f o r e   i t   a c k n o w l e d g e s   a n d   m a k e s   t h e m   v i s i b l e   t o   c l i e n t s .   W i t h o u t   r e s p e c t   t o   w e i g h t e d   q u o r u m s ,   a   q u o r u m   i s   a   m a j o r i t y   c o m p o n e n t   o f   t h e   e n s e m b l e   c o n t a i n i n g   t h e   c u r r e n t   l e a d e r .   F o r   i n s t a n c e ,   i f   t h e   e n s e m b l e   h a s   t h r e e   s e r v e r s ,   a   c o m p o n e n t   t h a t   c o n t a i n s   t h e   l e a d e r   a n d   o n e   o t h e r   s e r v e r   c o n s t i t u t e s   a   q u o r u


Question: What is Creating a ZooKeeper ensemble?

Answer: T h e   m a n i f e s t   b e l o w   c o n t a i n s   a   H e a d l e s s   S e r v i c e ,   a   S e r v i c e ,   a   P o d D i s r u p t i o n B u d g e t ,   a n d   a   S t a t e f u l S e t .   a p i V e r s i o n :   v 1   k i n d :   S e r v i c e   m e t a d a t a :   n a m e :   z k - h s   l a b e l s :   a p p :   z k   s p e c :   p o r t s :   -   p o r t :   2 8 8 8   n a m e :   s e r v e r   -   p o r t :   3 8 8 8   n a m e :   l e a d e r - e l e c t i o n   c l u s t e r I P :   N o n e   s e l e c t o r :   a p p :   z k   - - -   a p i V e r s i o n :   v 1   k i n d :   S e r v i c e   m e t a d a t a :   n a m e :   z k - c s   l a b e l s :   a p p :   z k   s p e c :   p o r t s :   -   p o r t :   2 1 8 1   n a m e :   c l i e n t   s e l e c t o r :   a p p :   z k   - - -   a p i V e r s i o n :   p o l i c y / v 1   k i n d :   P o d D i s r u p t i o n B u d g e t   m e t a d a t a :   n a m e :   z k - p d b   s p e c :   s e l e c t o r :   m a t c h L a b e l s :   a p p :   z k   m a x U n a v a i l a b l e :   1   - - -   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   m e t a d a t a :   n a m e :   z k   s p e c :   s e l e c t o r :   m a t c h L a b e l s :   a p p :   z k   s e r v i c e N a m e :   z k - h s   r e p l i c a s :   3   u p d a t e S t r a t e g y :   t y p e :   R o l l i n g U p d a t e   p o d M a n a g e m e n t P o l i c y :   O r d e r e d R e a d y   t e m p l a t e :   m e t a d a t a :   l a b e l s :   a p p :   z k   s p e c :   a f f i n i t y :   p o d A n t i A f f i n i t y :   r e q u i r e d D u r i n g S c h e d u l i n g I g n o r e d D u r i n g E x e c u t i o n :   -   l a b e l S e l e c t o r :   m a t c h E x p r e s s i o n s :   -   k e y :   " a p p "   o p e r a t o r :   I n   v a l u e s :   -   z k   t o p o l o g y K e y :   " k u b e r n e t e s . i o / h o s t n a m e "   c o n t a i n e r s :   -   n a m e :   k u b e r n e t e s - z o o k e e p


Question: What is Facilitating leader election?

Answer: B e c a u s e   t h e r e   i s   n o   t e r m i n a t i n g   a l g o r i t h m   f o r   e l e c t i n g   a   l e a d e r   i n   a n   a n o n y m o u s   n e t w o r k ,   Z a b   r e q u i r e s   e x p l i c i t   m e m b e r s h i p   c o n f i g u r a t i o n   t o   p e r f o r m   l e a d e r   e l e c t i o n .   E a c h   s e r v e r   i n   t h e   e n s e m b l e   n e e d s   t o   h a v e   a   u n i q u e   i d e n t i f i e r ,   a l l   s e r v e r s   n e e d   t o   k n o w   t h e   g l o b a l   s e t   o f   i d e n t i f i e r s ,   a n d   e a c h   i d e n t i f i e r   n e e d s   t o   b e   a s s o c i a t e d   w i t h   a   n e t w o r k   a d d r e s s .   U s e   k u b e c t l   e x e c   t o   g e t   t h e   h o s t n a m e s   o f   t h e   P o d s   i n   t h e   z k   S t a t e f u l S e t .   f o r   i   i n   0   1   2 ;   d o   k u b e c t l   e x e c   z k - $ i   - -   h o s t n a m e ;   d o n e   T h e   S t a t e f u l S e t   c o n t r o l l e r   p r o v i d e s   e a c h   P o d   w i t h   a   u n i q u e   h o s t n a m e   b a s e d   o n   i t s   o r d i n a l   i n d e x .   T h e   h o s t n a m e s   t a k e   t h e   f o r m   o f   < s t a t e f u l s e t   n a m e > - < o r d i n a l   i n d e x > .   B e c a u s e   t h e   r e p l i c a s   f i e l d   o f   t h e   z k   S t a t e f u l S e t   i s   s e t   t o   3 ,   t h e   S e t ' s   c o n t r o l l e r   c r e a t e s   t h r e e   P o d s   w i t h   t h e i r   h o s t n a m e s   s e t   t o   z k - 0 ,   z k - 1 ,   a n d   z k - 2 .   z k - 0   z k - 1   z k - 2   T h e   s e r v e r s   i n   a   Z o o K e e p e r   e n s e m b l e   u s e   n a t u r a l   n u m b e r s   a s   u n i q u e   i d e n t i f i e r s ,   a n d   s t o r e   e a c h   s e r v e r ' s   i d e n t i f i e r   i n   a   f i l e   c a l l e d   m y i d   i n   t h e   s e r v e r ' s   d a t a   d i r e c t o r y .   T o   e x a m i n e   t h e   c o n t e n t s


Question: What is Achieving consensus?

Answer: C o n s e n s u s   p r o t o c o l s   r e q u i r e   t h a t   t h e   i d e n t i f i e r s   o f   e a c h   p a r t i c i p a n t   b e   u n i q u e .   N o   t w o   p a r t i c i p a n t s   i n   t h e   Z a b   p r o t o c o l   s h o u l d   c l a i m   t h e   s a m e   u n i q u e   i d e n t i f i e r .   T h i s   i s   n e c e s s a r y   t o   a l l o w   t h e   p r o c e s s e s   i n   t h e   s y s t e m   t o   a g r e e   o n   w h i c h   p r o c e s s e s   h a v e   c o m m i t t e d   w h i c h   d a t a .   I f   t w o   P o d s   a r e   l a u n c h e d   w i t h   t h e   s a m e   o r d i n a l ,   t w o   Z o o K e e p e r   s e r v e r s   w o u l d   b o t h   i d e n t i f y   t h e m s e l v e s   a s   t h e   s a m e   s e r v e r .   k u b e c t l   g e t   p o d s   - w   - l   a p p = z k   N A M E   R E A D Y   S T A T U S   R E S T A R T S   A G E   z k - 0   0 / 1   P e n d i n g   0   0 s   z k - 0   0 / 1   P e n d i n g   0   0 s   z k - 0   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   z k - 0   0 / 1   R u n n i n g   0   1 9 s   z k - 0   1 / 1   R u n n i n g   0   4 0 s   z k - 1   0 / 1   P e n d i n g   0   0 s   z k - 1   0 / 1   P e n d i n g   0   0 s   z k - 1   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   z k - 1   0 / 1   R u n n i n g   0   1 8 s   z k - 1   1 / 1   R u n n i n g   0   4 0 s   z k - 2   0 / 1   P e n d i n g   0   0 s   z k - 2   0 / 1   P e n d i n g   0   0 s   z k - 2   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   z k - 2   0 / 1   R u n n i n g   0   1 9 s   z k - 2   1 / 1   R u n n i n g   0   4 0 s   T h e   A   r e c o r d s   f o r   e a c h   P o d   a r e   e n t e r e d   w h e n   t h e   P o d   b e c o m e s   R e a d y .   T h e r e f o r e ,   t h e   F Q D N s   o f   t h e   Z o o K e e p e r   s e r v e r s   w i l l   r e s o l v e   t o   a   s i n g l e   e n d p o i n t ,   a n d   t h a t   e n d p o i n t   w i l l   b e   t h e   u n i


Question: What is Sanity testing the ensemble?

Answer: T h e   m o s t   b a s i c   s a n i t y   t e s t   i s   t o   w r i t e   d a t a   t o   o n e   Z o o K e e p e r   s e r v e r   a n d   t o   r e a d   t h e   d a t a   f r o m   a n o t h e r .   T h e   c o m m a n d   b e l o w   e x e c u t e s   t h e   z k C l i . s h   s c r i p t   t o   w r i t e   w o r l d   t o   t h e   p a t h   / h e l l o   o n   t h e   z k - 0   P o d   i n   t h e   e n s e m b l e .   k u b e c t l   e x e c   z k - 0   - -   z k C l i . s h   c r e a t e   / h e l l o   w o r l d   W A T C H E R : :   W a t c h e d E v e n t   s t a t e : S y n c C o n n e c t e d   t y p e : N o n e   p a t h : n u l l   C r e a t e d   / h e l l o   T o   g e t   t h e   d a t a   f r o m   t h e   z k - 1   P o d   u s e   t h e   f o l l o w i n g   c o m m a n d .   k u b e c t l   e x e c   z k - 1   - -   z k C l i . s h   g e t   / h e l l o   T h e   d a t a   t h a t   y o u   c r e a t e d   o n   z k - 0   i s   a v a i l a b l e   o n   a l l   t h e   s e r v e r s   i n   t h e   e n s e m b l e .   W A T C H E R : :   W a t c h e d E v e n t   s t a t e : S y n c C o n n e c t e d   t y p e : N o n e   p a t h : n u l l   w o r l d   c Z x i d   =   0 x 1 0 0 0 0 0 0 0 2   c t i m e   =   T h u   D e c   0 8   1 5 : 1 3 : 3 0   U T C   2 0 1 6   m Z x i d   =   0 x 1 0 0 0 0 0 0 0 2   m t i m e   =   T h u   D e c   0 8   1 5 : 1 3 : 3 0   U T C   2 0 1 6   p Z x i d   =   0 x 1 0 0 0 0 0 0 0 2   c v e r s i o n   =   0   d a t a V e r s i o n   =   0   a c l V e r s i o n   =   0   e p h e m e r a l O w n e r   =   0 x 0   d a t a L e n g t h   =   5   n u m C h i l d r e n   =   0


Question: What is Providing durable storage?

Answer: A s   m e n t i o n e d   i n   t h e   Z o o K e e p e r   B a s i c s   s e c t i o n ,   Z o o K e e p e r   c o m m i t s   a l l   e n t r i e s   t o   a   d u r a b l e   W A L ,   a n d   p e r i o d i c a l l y   w r i t e s   s n a p s h o t s   i n   m e m o r y   s t a t e ,   t o   s t o r a g e   m e d i a .   U s i n g   W A L s   t o   p r o v i d e   d u r a b i l i t y   i s   a   c o m m o n   t e c h n i q u e   f o r   a p p l i c a t i o n s   t h a t   u s e   c o n s e n s u s   p r o t o c o l s   t o   a c h i e v e   a   r e p l i c a t e d   s t a t e   m a c h i n e .   U s e   t h e   k u b e c t l   d e l e t e   c o m m a n d   t o   d e l e t e   t h e   z k   S t a t e f u l S e t .   k u b e c t l   d e l e t e   s t a t e f u l s e t   z k   s t a t e f u l s e t . a p p s   " z k "   d e l e t e d   W a t c h   t h e   t e r m i n a t i o n   o f   t h e   P o d s   i n   t h e   S t a t e f u l S e t .   k u b e c t l   g e t   p o d s   - w   - l   a p p = z k   W h e n   z k - 0   i f   f u l l y   t e r m i n a t e d ,   u s e   C T R L - C   t o   t e r m i n a t e   k u b e c t l .   z k - 2   1 / 1   T e r m i n a t i n g   0   9 m   z k - 0   1 / 1   T e r m i n a t i n g   0   1 1 m   z k - 1   1 / 1   T e r m i n a t i n g   0   1 0 m   z k - 2   0 / 1   T e r m i n a t i n g   0   9 m   z k - 2   0 / 1   T e r m i n a t i n g   0   9 m   z k - 2   0 / 1   T e r m i n a t i n g   0   9 m   z k - 1   0 / 1   T e r m i n a t i n g   0   1 0 m   z k - 1   0 / 1   T e r m i n a t i n g   0   1 0 m   z k - 1   0 / 1   T e r m i n a t i n g   0   1 0 m   z k - 0   0 / 1   T e r m i n a t i n g   0   1 1 m   z k - 0   0 / 1   T e r m i n a t i n g   0   1 1 m   z k - 0   0 / 1   T e r m i n a t i n g   0   1 1 m   R e a p p l y   t h e   m a n i f e s t   i n   z o o k e e p e r . y a m l .   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a p p l i c a t i o n / z o o k e e p e r / z o o k e


Question: What is Ensuring consistent configuration?

Answer: A s   n o t e d   i n   t h e   F a c i l i t a t i n g   L e a d e r   E l e c t i o n   a n d   A c h i e v i n g   C o n s e n s u s   s e c t i o n s ,   t h e   s e r v e r s   i n   a   Z o o K e e p e r   e n s e m b l e   r e q u i r e   c o n s i s t e n t   c o n f i g u r a t i o n   t o   e l e c t   a   l e a d e r   a n d   f o r m   a   q u o r u m .   T h e y   a l s o   r e q u i r e   c o n s i s t e n t   c o n f i g u r a t i o n   o f   t h e   Z a b   p r o t o c o l   i n   o r d e r   f o r   t h e   p r o t o c o l   t o   w o r k   c o r r e c t l y   o v e r   a   n e t w o r k .   I n   o u r   e x a m p l e   w e   a c h i e v e   c o n s i s t e n t   c o n f i g u r a t i o n   b y   e m b e d d i n g   t h e   c o n f i g u r a t i o n   d i r e c t l y   i n t o   t h e   m a n i f e s t .   G e t   t h e   z k   S t a t e f u l S e t .   k u b e c t l   g e t   s t s   z k   - o   y a m l   …   c o m m a n d :   -   s h   -   - c   -   " s t a r t - z o o k e e p e r   \   - - s e r v e r s = 3   \   - - d a t a _ d i r = / v a r / l i b / z o o k e e p e r / d a t a   \   - - d a t a _ l o g _ d i r = / v a r / l i b / z o o k e e p e r / d a t a / l o g   \   - - c o n f _ d i r = / o p t / z o o k e e p e r / c o n f   \   - - c l i e n t _ p o r t = 2 1 8 1   \   - - e l e c t i o n _ p o r t = 3 8 8 8   \   - - s e r v e r _ p o r t = 2 8 8 8   \   - - t i c k _ t i m e = 2 0 0 0   \   - - i n i t _ l i m i t = 1 0   \   - - s y n c _ l i m i t = 5   \   - - h e a p = 5 1 2 M   \   - - m a x _ c l i e n t _ c n x n s = 6 0   \   - - s n a p _ r e t a i n _ c o u n t = 3   \   - - p u r g e _ i n t e r v a l = 1 2   \   - - m a x _ s e s s i o n _ t i m e o u t = 4 0 0 0 0   \   - - m i n _ s e s s i o n _ t i m e o u t = 4 0 0 0   \   - - l o g _ l e v e l = I N F O "   …   T h e   c o m m a n d   u s e d   t o   s t a r t   t h e   Z o o K e e p e r   s e r v e r s   p a s s e d   t h e   c o n f i g u r a t i o n   a s   c o


Question: What is Configuring logging?

Answer: O n e   o f   t h e   f i l e s   g e n e r a t e d   b y   t h e   z k G e n C o n f i g . s h   s c r i p t   c o n t r o l s   Z o o K e e p e r ' s   l o g g i n g .   Z o o K e e p e r   u s e s   L o g 4 j ,   a n d ,   b y   d e f a u l t ,   i t   u s e s   a   t i m e   a n d   s i z e   b a s e d   r o l l i n g   f i l e   a p p e n d e r   f o r   i t s   l o g g i n g   c o n f i g u r a t i o n .   U s e   t h e   c o m m a n d   b e l o w   t o   g e t   t h e   l o g g i n g   c o n f i g u r a t i o n   f r o m   o n e   o f   P o d s   i n   t h e   z k   S t a t e f u l S e t .   k u b e c t l   e x e c   z k - 0   c a t   / u s r / e t c / z o o k e e p e r / l o g 4 j . p r o p e r t i e s   T h e   l o g g i n g   c o n f i g u r a t i o n   b e l o w   w i l l   c a u s e   t h e   Z o o K e e p e r   p r o c e s s   t o   w r i t e   a l l   o f   i t s   l o g s   t o   t h e   s t a n d a r d   o u t p u t   f i l e   s t r e a m .   z o o k e e p e r . r o o t . l o g g e r = C O N S O L E   z o o k e e p e r . c o n s o l e . t h r e s h o l d = I N F O   l o g 4 j . r o o t L o g g e r = $ { z o o k e e p e r . r o o t . l o g g e r }   l o g 4 j . a p p e n d e r . C O N S O L E = o r g . a p a c h e . l o g 4 j . C o n s o l e A p p e n d e r   l o g 4 j . a p p e n d e r . C O N S O L E . T h r e s h o l d = $ { z o o k e e p e r . c o n s o l e . t h r e s h o l d }   l o g 4 j . a p p e n d e r . C O N S O L E . l a y o u t = o r g . a p a c h e . l o g 4 j . P a t t e r n L a y o u t   l o g 4 j . a p p e n d e r . C O N S O L E . l a y o u t . C o n v e r s i o n P a t t e r n = % d { I S O 8 6 0 1 }   [ m y i d : % X { m y i d } ]   -   % - 5 p   [ % t : % C { 1 } @ % L ]   -   % m % n   T h i s   i s   t h e   s i m p l e s t   p o s s i b l e   w a y   t o   s a f e l y   l o g   i n s i d e   t h e   c o n t a i n e r .   B e c a u s e   t h e   a p p l i c a t i o n s   w r i t e   l o g s   t o   s t a n d a r d   o u t ,


Question: What is Configuring a non-privileged user?

Answer: T h e   b e s t   p r a c t i c e s   t o   a l l o w   a n   a p p l i c a t i o n   t o   r u n   a s   a   p r i v i l e g e d   u s e r   i n s i d e   o f   a   c o n t a i n e r   a r e   a   m a t t e r   o f   d e b a t e .   I f   y o u r   o r g a n i z a t i o n   r e q u i r e s   t h a t   a p p l i c a t i o n s   r u n   a s   a   n o n - p r i v i l e g e d   u s e r   y o u   c a n   u s e   a   S e c u r i t y C o n t e x t   t o   c o n t r o l   t h e   u s e r   t h a t   t h e   e n t r y   p o i n t   r u n s   a s .   T h e   z k   S t a t e f u l S e t ' s   P o d   t e m p l a t e   c o n t a i n s   a   S e c u r i t y C o n t e x t .   s e c u r i t y C o n t e x t :   r u n A s U s e r :   1 0 0 0   f s G r o u p :   1 0 0 0   I n   t h e   P o d s '   c o n t a i n e r s ,   U I D   1 0 0 0   c o r r e s p o n d s   t o   t h e   z o o k e e p e r   u s e r   a n d   G I D   1 0 0 0   c o r r e s p o n d s   t o   t h e   z o o k e e p e r   g r o u p .   G e t   t h e   Z o o K e e p e r   p r o c e s s   i n f o r m a t i o n   f r o m   t h e   z k - 0   P o d .   k u b e c t l   e x e c   z k - 0   - -   p s   - e l f   A s   t h e   r u n A s U s e r   f i e l d   o f   t h e   s e c u r i t y C o n t e x t   o b j e c t   i s   s e t   t o   1 0 0 0 ,   i n s t e a d   o f   r u n n i n g   a s   r o o t ,   t h e   Z o o K e e p e r   p r o c e s s   r u n s   a s   t h e   z o o k e e p e r   u s e r .   F   S   U I D   P I D   P P I D   C   P R I   N I   A D D R   S Z   W C H A N   S T I M E   T T Y   T I M E   C M D   4   S   z o o k e e p +   1   0   0   8 0   0   -   1 1 2 7   -   2 0 : 4 6   ?   0 0 : 0 0 : 0 0   s h   - c   z k G e n C o n f i g . s h   & &   z k S e r v e r . s h   s t a r t - f o r e g r o u n d   0   S   z o o k e e p +   2 7   1   0   8 0   0   -   1 1 5 5 5 5 6   -   2 0 : 4 6   ?   0 0 : 0 0 : 1 9   / u s r / l i b / j v m / j a v a - 8 - o p e n j d k - a m d 6 4 / b i n / j a v a   - D z o o k e e


Question: What is Managing the ZooKeeper process?

Answer: T h e   Z o o K e e p e r   d o c u m e n t a t i o n   m e n t i o n s   t h a t   " Y o u   w i l l   w a n t   t o   h a v e   a   s u p e r v i s o r y   p r o c e s s   t h a t   m a n a g e s   e a c h   o f   y o u r   Z o o K e e p e r   s e r v e r   p r o c e s s e s   ( J V M ) . "   U t i l i z i n g   a   w a t c h d o g   ( s u p e r v i s o r y   p r o c e s s )   t o   r e s t a r t   f a i l e d   p r o c e s s e s   i n   a   d i s t r i b u t e d   s y s t e m   i s   a   c o m m o n   p a t t e r n .   W h e n   d e p l o y i n g   a n   a p p l i c a t i o n   i n   K u b e r n e t e s ,   r a t h e r   t h a n   u s i n g   a n   e x t e r n a l   u t i l i t y   a s   a   s u p e r v i s o r y   p r o c e s s ,   y o u   s h o u l d   u s e   K u b e r n e t e s   a s   t h e   w a t c h d o g   f o r   y o u r   a p p l i c a t i o n .


Question: What is Updating the ensemble?

Answer: T h e   z k   S t a t e f u l S e t   i s   c o n f i g u r e d   t o   u s e   t h e   R o l l i n g U p d a t e   u p d a t e   s t r a t e g y .   Y o u   c a n   u s e   k u b e c t l   p a t c h   t o   u p d a t e   t h e   n u m b e r   o f   c p u s   a l l o c a t e d   t o   t h e   s e r v e r s .   k u b e c t l   p a t c h   s t s   z k   - - t y p e = ' j s o n '   - p = ' [ { " o p " :   " r e p l a c e " ,   " p a t h " :   " / s p e c / t e m p l a t e / s p e c / c o n t a i n e r s / 0 / r e s o u r c e s / r e q u e s t s / c p u " ,   " v a l u e " : " 0 . 3 " } ] '   s t a t e f u l s e t . a p p s / z k   p a t c h e d   U s e   k u b e c t l   r o l l o u t   s t a t u s   t o   w a t c h   t h e   s t a t u s   o f   t h e   u p d a t e .   k u b e c t l   r o l l o u t   s t a t u s   s t s / z k   w a i t i n g   f o r   s t a t e f u l s e t   r o l l i n g   u p d a t e   t o   c o m p l e t e   0   p o d s   a t   r e v i s i o n   z k - 5 d b 4 4 9 9 6 6 4 . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   w a i t i n g   f o r   s t a t e f u l s e t   r o l l i n g   u p d a t e   t o   c o m p l e t e   1   p o d s   a t   r e v i s i o n   z k - 5 d b 4 4 9 9 6 6 4 . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   w a i t i n g   f o r   s t a t e f u l s e t   r o l l i n g   u p d a t e   t o   c o m p l e t e   2   p o d s   a t   r e v i s i o n   z k - 5 d b 4 4 9 9 6 6 4 . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   W a i t i n g   f o r   1   p o d s   t o   b e   r e a d y . . .   s t a t e f u l s e t   r o l l i n g   u p d a t e   c o m p l e t e   3   p o d s   a t   r e v i s i o n   z k - 5 d b 4 4 9 9 6 6 4 . . .   T h i s   t e r m i n a t e s   t h e   P o d s ,   o n e   a t   a   t i m e ,   i n   r


Question: What is Handling process failure?

Answer: R e s t a r t   P o l i c i e s   c o n t r o l   h o w   K u b e r n e t e s   h a n d l e s   p r o c e s s   f a i l u r e s   f o r   t h e   e n t r y   p o i n t   o f   t h e   c o n t a i n e r   i n   a   P o d .   F o r   P o d s   i n   a   S t a t e f u l S e t ,   t h e   o n l y   a p p r o p r i a t e   R e s t a r t P o l i c y   i s   A l w a y s ,   a n d   t h i s   i s   t h e   d e f a u l t   v a l u e .   F o r   s t a t e f u l   a p p l i c a t i o n s   y o u   s h o u l d   n e v e r   o v e r r i d e   t h e   d e f a u l t   p o l i c y .   U s e   t h e   f o l l o w i n g   c o m m a n d   t o   e x a m i n e   t h e   p r o c e s s   t r e e   f o r   t h e   Z o o K e e p e r   s e r v e r   r u n n i n g   i n   t h e   z k - 0   P o d .   k u b e c t l   e x e c   z k - 0   - -   p s   - e f   T h e   c o m m a n d   u s e d   a s   t h e   c o n t a i n e r ' s   e n t r y   p o i n t   h a s   P I D   1 ,   a n d   t h e   Z o o K e e p e r   p r o c e s s ,   a   c h i l d   o f   t h e   e n t r y   p o i n t ,   h a s   P I D   2 7 .   U I D   P I D   P P I D   C   S T I M E   T T Y   T I M E   C M D   z o o k e e p +   1   0   0   1 5 : 0 3   ?   0 0 : 0 0 : 0 0   s h   - c   z k G e n C o n f i g . s h   & &   z k S e r v e r . s h   s t a r t - f o r e g r o u n d   z o o k e e p +   2 7   1   0   1 5 : 0 3   ?   0 0 : 0 0 : 0 3   / u s r / l i b / j v m / j a v a - 8 - o p e n j d k - a m d 6 4 / b i n / j a v a   - D z o o k e e p e r . l o g . d i r = / v a r / l o g / z o o k e e p e r   - D z o o k e e p e r . r o o t . l o g g e r = I N F O , C O N S O L E   - c p   / u s r / b i n / . . / b u i l d / c l a s s e s : / u s r / b i n / . . / b u i l d / l i b / * . j a r : / u s r / b i n / . . / s h a r e / z o o k e e p e r / z o o k e e p e r - 3 . 4 . 9 . j a r : / u s r / b i n / . . / s h a r e / z o o k e e p e r / s l f 4 j - l o g 4 j 1 2 - 1 . 6 . 1 . j a r : / u s r / b i n / . . / s h a r e / z o o k e e p


Question: What is Testing for liveness?

Answer: C o n f i g u r i n g   y o u r   a p p l i c a t i o n   t o   r e s t a r t   f a i l e d   p r o c e s s e s   i s   n o t   e n o u g h   t o   k e e p   a   d i s t r i b u t e d   s y s t e m   h e a l t h y .   T h e r e   a r e   s c e n a r i o s   w h e r e   a   s y s t e m ' s   p r o c e s s e s   c a n   b e   b o t h   a l i v e   a n d   u n r e s p o n s i v e ,   o r   o t h e r w i s e   u n h e a l t h y .   Y o u   s h o u l d   u s e   l i v e n e s s   p r o b e s   t o   n o t i f y   K u b e r n e t e s   t h a t   y o u r   a p p l i c a t i o n ' s   p r o c e s s e s   a r e   u n h e a l t h y   a n d   i t   s h o u l d   r e s t a r t   t h e m .   T h e   P o d   t e m p l a t e   f o r   t h e   z k   S t a t e f u l S e t   s p e c i f i e s   a   l i v e n e s s   p r o b e .   l i v e n e s s P r o b e :   e x e c :   c o m m a n d :   -   s h   -   - c   -   " z o o k e e p e r - r e a d y   2 1 8 1 "   i n i t i a l D e l a y S e c o n d s :   1 5   t i m e o u t S e c o n d s :   5   T h e   p r o b e   c a l l s   a   b a s h   s c r i p t   t h a t   u s e s   t h e   Z o o K e e p e r   r u o k   f o u r   l e t t e r   w o r d   t o   t e s t   t h e   s e r v e r ' s   h e a l t h .   O K = $ ( e c h o   r u o k   |   n c   1 2 7 . 0 . 0 . 1   $ 1 )   i f   [   " $ O K "   = =   " i m o k "   ] ;   t h e n   e x i t   0   e l s e   e x i t   1   f i   I n   o n e   t e r m i n a l   w i n d o w ,   u s e   t h e   f o l l o w i n g   c o m m a n d   t o   w a t c h   t h e   P o d s   i n   t h e   z k   S t a t e f u l S e t .   k u b e c t l   g e t   p o d   - w   - l   a p p = z k   I n   a n o t h e r   w i n d o w ,   u s i n g   t h e   f o l l o w i n g   c o m m a n d   t o   d e l e t e   t h e   z o o k e e p e r - r e a d y   s c r i p t   f r o m   t h e   f i l e   s y s t e m   o f   P o d   z k - 0 .   k u b e c t l   e x e c   z k - 0   - -   r m   / o p t / z o o k e e p e r / b i n / z o o k e e p e r -


Question: What is Testing for readiness?

Answer: R e a d i n e s s   i s   n o t   t h e   s a m e   a s   l i v e n e s s .   I f   a   p r o c e s s   i s   a l i v e ,   i t   i s   s c h e d u l e d   a n d   h e a l t h y .   I f   a   p r o c e s s   i s   r e a d y ,   i t   i s   a b l e   t o   p r o c e s s   i n p u t .   L i v e n e s s   i s   a   n e c e s s a r y ,   b u t   n o t   s u f f i c i e n t ,   c o n d i t i o n   f o r   r e a d i n e s s .   T h e r e   a r e   c a s e s ,   p a r t i c u l a r l y   d u r i n g   i n i t i a l i z a t i o n   a n d   t e r m i n a t i o n ,   w h e n   a   p r o c e s s   c a n   b e   a l i v e   b u t   n o t   r e a d y .   I f   y o u   s p e c i f y   a   r e a d i n e s s   p r o b e ,   K u b e r n e t e s   w i l l   e n s u r e   t h a t   y o u r   a p p l i c a t i o n ' s   p r o c e s s e s   w i l l   n o t   r e c e i v e   n e t w o r k   t r a f f i c   u n t i l   t h e i r   r e a d i n e s s   c h e c k s   p a s s .   F o r   a   Z o o K e e p e r   s e r v e r ,   l i v e n e s s   i m p l i e s   r e a d i n e s s .   T h e r e f o r e ,   t h e   r e a d i n e s s   p r o b e   f r o m   t h e   z o o k e e p e r . y a m l   m a n i f e s t   i s   i d e n t i c a l   t o   t h e   l i v e n e s s   p r o b e .   r e a d i n e s s P r o b e :   e x e c :   c o m m a n d :   -   s h   -   - c   -   " z o o k e e p e r - r e a d y   2 1 8 1 "   i n i t i a l D e l a y S e c o n d s :   1 5   t i m e o u t S e c o n d s :   5   E v e n   t h o u g h   t h e   l i v e n e s s   a n d   r e a d i n e s s   p r o b e s   a r e   i d e n t i c a l ,   i t   i s   i m p o r t a n t   t o   s p e c i f y   b o t h .   T h i s   e n s u r e s   t h a t   o n l y   h e a l t h y   s e r v e r s   i n   t h e   Z o o K e e p e r   e n s e m b l e   r e c e i v e   n e t w o r k   t r a f f i c .


Question: What is Tolerating Node failure?

Answer: Z o o K e e p e r   n e e d s   a   q u o r u m   o f   s e r v e r s   t o   s u c c e s s f u l l y   c o m m i t   m u t a t i o n s   t o   d a t a .   F o r   a   t h r e e   s e r v e r   e n s e m b l e ,   t w o   s e r v e r s   m u s t   b e   h e a l t h y   f o r   w r i t e s   t o   s u c c e e d .   I n   q u o r u m   b a s e d   s y s t e m s ,   m e m b e r s   a r e   d e p l o y e d   a c r o s s   f a i l u r e   d o m a i n s   t o   e n s u r e   a v a i l a b i l i t y .   T o   a v o i d   a n   o u t a g e ,   d u e   t o   t h e   l o s s   o f   a n   i n d i v i d u a l   m a c h i n e ,   b e s t   p r a c t i c e s   p r e c l u d e   c o - l o c a t i n g   m u l t i p l e   i n s t a n c e s   o f   t h e   a p p l i c a t i o n   o n   t h e   s a m e   m a c h i n e .   B y   d e f a u l t ,   K u b e r n e t e s   m a y   c o - l o c a t e   P o d s   i n   a   S t a t e f u l S e t   o n   t h e   s a m e   n o d e .   F o r   t h e   t h r e e   s e r v e r   e n s e m b l e   y o u   c r e a t e d ,   i f   t w o   s e r v e r s   a r e   o n   t h e   s a m e   n o d e ,   a n d   t h a t   n o d e   f a i l s ,   t h e   c l i e n t s   o f   y o u r   Z o o K e e p e r   s e r v i c e   w i l l   e x p e r i e n c e   a n   o u t a g e   u n t i l   a t   l e a s t   o n e   o f   t h e   P o d s   c a n   b e   r e s c h e d u l e d .   Y o u   s h o u l d   a l w a y s   p r o v i s i o n   a d d i t i o n a l   c a p a c i t y   t o   a l l o w   t h e   p r o c e s s e s   o f   c r i t i c a l   s y s t e m s   t o   b e   r e s c h e d u l e d   i n   t h e   e v e n t   o f   n o d e   f a i l u r e s .   I f   y o u   d o   s o ,   t h e n   t h e   o u t a g e   w i l l   o n l y   l a s t   u n t i l   t h e   K u b e r n e t e s   s c h e d u l e r   r e s c h e d u l e s   o n e   o f   t h e   Z o o K e e p e r   s e r v e r s .   H o w e v e r ,   i f   y o u   w a n t   y o u r   s e r v i c e   t o   t o l e


Question: What is Surviving maintenance?

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


Question: What is Cleaning up?

Answer: U s e   k u b e c t l   u n c o r d o n   t o   u n c o r d o n   a l l   t h e   n o d e s   i n   y o u r   c l u s t e r . Y o u   m u s t   d e l e t e   t h e   p e r s i s t e n t   s t o r a g e   m e d i a   f o r   t h e   P e r s i s t e n t V o l u m e s   u s e d   i n   t h i s   t u t o r i a l .   F o l l o w   t h e   n e c e s s a r y   s t e p s ,   b a s e d   o n   y o u r   e n v i r o n m e n t ,   s t o r a g e   c o n f i g u r a t i o n ,   a n d   p r o v i s i o n i n g   m e t h o d ,   t o   e n s u r e   t h a t   a l l   s t o r a g e   i s   r e c l a i m e d .


Question: What is Configuration?

Answer: This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.ConfigurationResources that Kubernetes provides for configuring Pods.1: Configuration Best Practices2: ConfigMaps3: Secrets4: Liveness, Readiness, and Startup Probes5: Resource Management for Pods and Containers6: Organizing Cluster Access Using kubeconfig Files7: Resource Management for Windows nodes1 - Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as "yes" or "no".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list."Naked" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to


Question: How does Configuration work?

Answer: This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.ConfigurationResources that Kubernetes provides for configuring Pods.1: Configuration Best Practices2: ConfigMaps3: Secrets4: Liveness, Readiness, and Startup Probes5: Resource Management for Pods and Containers6: Organizing Cluster Access Using kubeconfig Files7: Resource Management for Windows nodes1 - Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as "yes" or "no".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list."Naked" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to


Question: When would you use Configuration?

Answer: This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.ConfigurationResources that Kubernetes provides for configuring Pods.1: Configuration Best Practices2: ConfigMaps3: Secrets4: Liveness, Readiness, and Startup Probes5: Resource Management for Pods and Containers6: Organizing Cluster Access Using kubeconfig Files7: Resource Management for Windows nodes1 - Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as "yes" or "no".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list."Naked" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to


Question: What are the benefits of Configuration?

Answer: This is the multi-page printable view of this section. Click here to print.Return to the regular view of this page.ConfigurationResources that Kubernetes provides for configuring Pods.1: Configuration Best Practices2: ConfigMaps3: Secrets4: Liveness, Readiness, and Startup Probes5: Resource Management for Pods and Containers6: Organizing Cluster Access Using kubeconfig Files7: Resource Management for Windows nodes1 - Configuration Best PracticesThis document highlights and consolidates configuration best practices that are introduced throughout the user guide, Getting Started documentation, and examples.This is a living document. If you think of something that is not on this list but might be useful to others, please don't hesitate to file an issue or submit a PR.General Configuration TipsWhen defining configurations, specify the latest stable API version.Configuration files should be stored in version control before being pushed to the cluster. This allows you to quickly roll back a configuration change if necessary. It also aids cluster re-creation and restoration.Write your configuration files using YAML rather than JSON. Though these formats can be used interchangeably in almost all scenarios, YAML tends to be more user-friendly.Group related objects into a single file whenever it makes sense. One file is often easier to manage than several. See the guestbook-all-in-one.yaml file as an example of this syntax.Note also that many kubectl commands can be called on a directory. For example, you can call kubectl apply on a directory of config files.Don't specify default values unnecessarily: simple, minimal configuration will make errors less likely.Put object descriptions in annotations, to allow better introspection.Note:There is a breaking change introduced in the YAML 1.2 boolean values specification with respect to YAML 1.1. This is a known issue in Kubernetes. YAML 1.2 only recognizes true and false as valid booleans, while YAML 1.1 also accepts yes, no, on, and off as booleans. However, Kubernetes uses YAML parsers that are mostly compatible with YAML 1.1, which means that using yes or no instead of true or false in a YAML manifest may cause unexpected errors or behaviors. To avoid this issue, it is recommended to always use true or false for boolean values in YAML manifests, and to quote any strings that may be confused with booleans, such as "yes" or "no".Besides booleans, there are additional specifications changes between YAML versions. Please refer to the YAML Specification Changes documentation for a comprehensive list."Naked" Pods versus ReplicaSets, Deployments, and JobsDon't use naked Pods (that is, Pods not bound to a ReplicaSet or Deployment) if you can avoid it. Naked Pods will not be rescheduled in the event of a node failure.A Deployment, which both creates a ReplicaSet to ensure that the desired number of Pods is always available, and specifies a strategy to replace Pods (such as RollingUpdate), is almost always preferable to


Question: What is Configuration?

Answer: 1 :   C o n f i g u r a t i o n   B e s t   P r a c t i c e s 2 :   C o n f i g M a p s 3 :   S e c r e t s 4 :   L i v e n e s s ,   R e a d i n e s s ,   a n d   S t a r t u p   P r o b e s 5 :   R e s o u r c e   M a n a g e m e n t   f o r   P o d s   a n d   C o n t a i n e r s 6 :   O r g a n i z i n g   C l u s t e r   A c c e s s   U s i n g   k u b e c o n f i g   F i l e s 7 :   R e s o u r c e   M a n a g e m e n t   f o r   W i n d o w s   n o d e s


Question: What is 1 - Configuration Best Practices?

Answer: T h i s   d o c u m e n t   h i g h l i g h t s   a n d   c o n s o l i d a t e s   c o n f i g u r a t i o n   b e s t   p r a c t i c e s   t h a t   a r e   i n t r o d u c e d   t h r o u g h o u t   t h e   u s e r   g u i d e ,   G e t t i n g   S t a r t e d   d o c u m e n t a t i o n ,   a n d   e x a m p l e s .   T h i s   i s   a   l i v i n g   d o c u m e n t .   I f   y o u   t h i n k   o f   s o m e t h i n g   t h a t   i s   n o t   o n   t h i s   l i s t   b u t   m i g h t   b e   u s e f u l   t o   o t h e r s ,   p l e a s e   d o n ' t   h e s i t a t e   t o   f i l e   a n   i s s u e   o r   s u b m i t   a   P R .


Question: What is General Configuration Tips?

Answer: W h e n   d e f i n i n g   c o n f i g u r a t i o n s ,   s p e c i f y   t h e   l a t e s t   s t a b l e   A P I   v e r s i o n . C o n f i g u r a t i o n   f i l e s   s h o u l d   b e   s t o r e d   i n   v e r s i o n   c o n t r o l   b e f o r e   b e i n g   p u s h e d   t o   t h e   c l u s t e r .   T h i s   a l l o w s   y o u   t o   q u i c k l y   r o l l   b a c k   a   c o n f i g u r a t i o n   c h a n g e   i f   n e c e s s a r y .   I t   a l s o   a i d s   c l u s t e r   r e - c r e a t i o n   a n d   r e s t o r a t i o n . W r i t e   y o u r   c o n f i g u r a t i o n   f i l e s   u s i n g   Y A M L   r a t h e r   t h a n   J S O N .   T h o u g h   t h e s e   f o r m a t s   c a n   b e   u s e d   i n t e r c h a n g e a b l y   i n   a l m o s t   a l l   s c e n a r i o s ,   Y A M L   t e n d s   t o   b e   m o r e   u s e r - f r i e n d l y . G r o u p   r e l a t e d   o b j e c t s   i n t o   a   s i n g l e   f i l e   w h e n e v e r   i t   m a k e s   s e n s e .   O n e   f i l e   i s   o f t e n   e a s i e r   t o   m a n a g e   t h a n   s e v e r a l .   S e e   t h e   g u e s t b o o k - a l l - i n - o n e . y a m l   f i l e   a s   a n   e x a m p l e   o f   t h i s   s y n t a x . N o t e   a l s o   t h a t   m a n y   k u b e c t l   c o m m a n d s   c a n   b e   c a l l e d   o n   a   d i r e c t o r y .   F o r   e x a m p l e ,   y o u   c a n   c a l l   k u b e c t l   a p p l y   o n   a   d i r e c t o r y   o f   c o n f i g   f i l e s . D o n ' t   s p e c i f y   d e f a u l t   v a l u e s   u n n e c e s s a r i l y :   s i m p l e ,   m i n i m a l   c o n f i g u r a t i o n   w i l l   m a k e   e r r o r s   l e s s   l i k e l y . P u t   o b j e c t   d e s c r i p t i o n s   i n   a n n o t a t i o n s ,   t o   a l l o w   b e t t e r   i n t r o s p e c t i o n .   W h e n   d e f i n i n g   c o n f i g u r a t i o n s ,   s p e c i f y   t h e   l a t e s t   s t a


Question: What is Note:?

Answer: T h e r e   i s   a   b r e a k i n g   c h a n g e   i n t r o d u c e d   i n   t h e   Y A M L   1 . 2   b o o l e a n   v a l u e s   s p e c i f i c a t i o n   w i t h   r e s p e c t   t o   Y A M L   1 . 1 .   T h i s   i s   a   k n o w n   i s s u e   i n   K u b e r n e t e s .   Y A M L   1 . 2   o n l y   r e c o g n i z e s   t r u e   a n d   f a l s e   a s   v a l i d   b o o l e a n s ,   w h i l e   Y A M L   1 . 1   a l s o   a c c e p t s   y e s ,   n o ,   o n ,   a n d   o f f   a s   b o o l e a n s .   H o w e v e r ,   K u b e r n e t e s   u s e s   Y A M L   p a r s e r s   t h a t   a r e   m o s t l y   c o m p a t i b l e   w i t h   Y A M L   1 . 1 ,   w h i c h   m e a n s   t h a t   u s i n g   y e s   o r   n o   i n s t e a d   o f   t r u e   o r   f a l s e   i n   a   Y A M L   m a n i f e s t   m a y   c a u s e   u n e x p e c t e d   e r r o r s   o r   b e h a v i o r s .   T o   a v o i d   t h i s   i s s u e ,   i t   i s   r e c o m m e n d e d   t o   a l w a y s   u s e   t r u e   o r   f a l s e   f o r   b o o l e a n   v a l u e s   i n   Y A M L   m a n i f e s t s ,   a n d   t o   q u o t e   a n y   s t r i n g s   t h a t   m a y   b e   c o n f u s e d   w i t h   b o o l e a n s ,   s u c h   a s   " y e s "   o r   " n o " .   B e s i d e s   b o o l e a n s ,   t h e r e   a r e   a d d i t i o n a l   s p e c i f i c a t i o n s   c h a n g e s   b e t w e e n   Y A M L   v e r s i o n s .   P l e a s e   r e f e r   t o   t h e   Y A M L   S p e c i f i c a t i o n   C h a n g e s   d o c u m e n t a t i o n   f o r   a   c o m p r e h e n s i v e   l i s t .


Question: What is "Naked" Pods versus ReplicaSets, Deployments, and Jobs?

Answer: D o n ' t   u s e   n a k e d   P o d s   ( t h a t   i s ,   P o d s   n o t   b o u n d   t o   a   R e p l i c a S e t   o r   D e p l o y m e n t )   i f   y o u   c a n   a v o i d   i t .   N a k e d   P o d s   w i l l   n o t   b e   r e s c h e d u l e d   i n   t h e   e v e n t   o f   a   n o d e   f a i l u r e . A   D e p l o y m e n t ,   w h i c h   b o t h   c r e a t e s   a   R e p l i c a S e t   t o   e n s u r e   t h a t   t h e   d e s i r e d   n u m b e r   o f   P o d s   i s   a l w a y s   a v a i l a b l e ,   a n d   s p e c i f i e s   a   s t r a t e g y   t o   r e p l a c e   P o d s   ( s u c h   a s   R o l l i n g U p d a t e ) ,   i s   a l m o s t   a l w a y s   p r e f e r a b l e   t o   c r e a t i n g   P o d s   d i r e c t l y ,   e x c e p t   f o r   s o m e   e x p l i c i t   r e s t a r t P o l i c y :   N e v e r   s c e n a r i o s .   A   J o b   m a y   a l s o   b e   a p p r o p r i a t e .   D o n ' t   u s e   n a k e d   P o d s   ( t h a t   i s ,   P o d s   n o t   b o u n d   t o   a   R e p l i c a S e t   o r   D e p l o y m e n t )   i f   y o u   c a n   a v o i d   i t .   N a k e d   P o d s   w i l l   n o t   b e   r e s c h e d u l e d   i n   t h e   e v e n t   o f   a   n o d e   f a i l u r e .   A   D e p l o y m e n t ,   w h i c h   b o t h   c r e a t e s   a   R e p l i c a S e t   t o   e n s u r e   t h a t   t h e   d e s i r e d   n u m b e r   o f   P o d s   i s   a l w a y s   a v a i l a b l e ,   a n d   s p e c i f i e s   a   s t r a t e g y   t o   r e p l a c e   P o d s   ( s u c h   a s   R o l l i n g U p d a t e ) ,   i s   a l m o s t   a l w a y s   p r e f e r a b l e   t o   c r e a t i n g   P o d s   d i r e c t l y ,   e x c e p t   f o r   s o m e   e x p l i c i t   r e s t a r t P o l i c y :   N e v e r   s c e n a r i o s .   A   J o b   m a y   a l s o   b e   a p p r o p r i a t e .


Question: What is Services?

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


Question: What is Using Labels?

Answer: D e f i n e   a n d   u s e   l a b e l s   t h a t   i d e n t i f y   s e m a n t i c   a t t r i b u t e s   o f   y o u r   a p p l i c a t i o n   o r   D e p l o y m e n t ,   s u c h   a s   {   a p p . k u b e r n e t e s . i o / n a m e :   M y A p p ,   t i e r :   f r o n t e n d ,   p h a s e :   t e s t ,   d e p l o y m e n t :   v 3   } .   Y o u   c a n   u s e   t h e s e   l a b e l s   t o   s e l e c t   t h e   a p p r o p r i a t e   P o d s   f o r   o t h e r   r e s o u r c e s ;   f o r   e x a m p l e ,   a   S e r v i c e   t h a t   s e l e c t s   a l l   t i e r :   f r o n t e n d   P o d s ,   o r   a l l   p h a s e :   t e s t   c o m p o n e n t s   o f   a p p . k u b e r n e t e s . i o / n a m e :   M y A p p .   S e e   t h e   g u e s t b o o k   a p p   f o r   e x a m p l e s   o f   t h i s   a p p r o a c h . A   S e r v i c e   c a n   b e   m a d e   t o   s p a n   m u l t i p l e   D e p l o y m e n t s   b y   o m i t t i n g   r e l e a s e - s p e c i f i c   l a b e l s   f r o m   i t s   s e l e c t o r .   W h e n   y o u   n e e d   t o   u p d a t e   a   r u n n i n g   s e r v i c e   w i t h o u t   d o w n t i m e ,   u s e   a   D e p l o y m e n t . A   d e s i r e d   s t a t e   o f   a n   o b j e c t   i s   d e s c r i b e d   b y   a   D e p l o y m e n t ,   a n d   i f   c h a n g e s   t o   t h a t   s p e c   a r e   a p p l i e d ,   t h e   d e p l o y m e n t   c o n t r o l l e r   c h a n g e s   t h e   a c t u a l   s t a t e   t o   t h e   d e s i r e d   s t a t e   a t   a   c o n t r o l l e d   r a t e . U s e   t h e   K u b e r n e t e s   c o m m o n   l a b e l s   f o r   c o m m o n   u s e   c a s e s .   T h e s e   s t a n d a r d i z e d   l a b e l s   e n r i c h   t h e   m e t a d a t a   i n   a   w a y   t h a t   a l l o w s   t o o l s ,   i n c l u d i n g   k u b e c t l   a n d   d a s h b o a r d ,   t o   w o r k   i n   a n   i n t e r o p e r a b l e   w


Question: What is Using kubectl?

Answer: U s e   k u b e c t l   a p p l y   - f   < d i r e c t o r y > .   T h i s   l o o k s   f o r   K u b e r n e t e s   c o n f i g u r a t i o n   i n   a l l   . y a m l ,   . y m l ,   a n d   . j s o n   f i l e s   i n   < d i r e c t o r y >   a n d   p a s s e s   i t   t o   a p p l y . U s e   l a b e l   s e l e c t o r s   f o r   g e t   a n d   d e l e t e   o p e r a t i o n s   i n s t e a d   o f   s p e c i f i c   o b j e c t   n a m e s .   S e e   t h e   s e c t i o n s   o n   l a b e l   s e l e c t o r s   a n d   u s i n g   l a b e l s   e f f e c t i v e l y . U s e   k u b e c t l   c r e a t e   d e p l o y m e n t   a n d   k u b e c t l   e x p o s e   t o   q u i c k l y   c r e a t e   s i n g l e - c o n t a i n e r   D e p l o y m e n t s   a n d   S e r v i c e s .   S e e   U s e   a   S e r v i c e   t o   A c c e s s   a n   A p p l i c a t i o n   i n   a   C l u s t e r   f o r   a n   e x a m p l e .   U s e   k u b e c t l   a p p l y   - f   < d i r e c t o r y > .   T h i s   l o o k s   f o r   K u b e r n e t e s   c o n f i g u r a t i o n   i n   a l l   . y a m l ,   . y m l ,   a n d   . j s o n   f i l e s   i n   < d i r e c t o r y >   a n d   p a s s e s   i t   t o   a p p l y .   U s e   l a b e l   s e l e c t o r s   f o r   g e t   a n d   d e l e t e   o p e r a t i o n s   i n s t e a d   o f   s p e c i f i c   o b j e c t   n a m e s .   S e e   t h e   s e c t i o n s   o n   l a b e l   s e l e c t o r s   a n d   u s i n g   l a b e l s   e f f e c t i v e l y .   U s e   k u b e c t l   c r e a t e   d e p l o y m e n t   a n d   k u b e c t l   e x p o s e   t o   q u i c k l y   c r e a t e   s i n g l e - c o n t a i n e r   D e p l o y m e n t s   a n d   S e r v i c e s .   S e e   U s e   a   S e r v i c e   t o   A c c e s s   a n   A p p l i c a t i o n   i n   a   C l u s t e r   f o r   a n   e x a m p l e .