Question: What is More practical use-cases?

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


Question: What is nodeName?

Answer: n o d e N a m e   i s   a   m o r e   d i r e c t   f o r m   o f   n o d e   s e l e c t i o n   t h a n   a f f i n i t y   o r   n o d e S e l e c t o r .   n o d e N a m e   i s   a   f i e l d   i n   t h e   P o d   s p e c .   I f   t h e   n o d e N a m e   f i e l d   i s   n o t   e m p t y ,   t h e   s c h e d u l e r   i g n o r e s   t h e   P o d   a n d   t h e   k u b e l e t   o n   t h e   n a m e d   n o d e   t r i e s   t o   p l a c e   t h e   P o d   o n   t h a t   n o d e .   U s i n g   n o d e N a m e   o v e r r u l e s   u s i n g   n o d e S e l e c t o r   o r   a f f i n i t y   a n d   a n t i - a f f i n i t y   r u l e s .   S o m e   o f   t h e   l i m i t a t i o n s   o f   u s i n g   n o d e N a m e   t o   s e l e c t   n o d e s   a r e :   I f   t h e   n a m e d   n o d e   d o e s   n o t   e x i s t ,   t h e   P o d   w i l l   n o t   r u n ,   a n d   i n   s o m e   c a s e s   m a y   b e   a u t o m a t i c a l l y   d e l e t e d . I f   t h e   n a m e d   n o d e   d o e s   n o t   h a v e   t h e   r e s o u r c e s   t o   a c c o m m o d a t e   t h e   P o d ,   t h e   P o d   w i l l   f a i l   a n d   i t s   r e a s o n   w i l l   i n d i c a t e   w h y ,   f o r   e x a m p l e   O u t O f m e m o r y   o r   O u t O f c p u . N o d e   n a m e s   i n   c l o u d   e n v i r o n m e n t s   a r e   n o t   a l w a y s   p r e d i c t a b l e   o r   s t a b l e .


Question: What is Warning:?

Answer: H e r e   i s   a n   e x a m p l e   o f   a   P o d   s p e c   u s i n g   t h e   n o d e N a m e   f i e l d :   a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   n g i n x   s p e c :   c o n t a i n e r s :   -   n a m e :   n g i n x   i m a g e :   n g i n x   n o d e N a m e :   k u b e - 0 1   T h e   a b o v e   P o d   w i l l   o n l y   r u n   o n   t h e   n o d e   k u b e - 0 1 .


Question: What is nominatedNodeName?

Answer: n o m i n a t e d N o d e N a m e   c a n   b e   u s e d   f o r   e x t e r n a l   c o m p o n e n t s   t o   n o m i n a t e   n o d e   f o r   a   p e n d i n g   p o d .   T h i s   n o m i n a t i o n   i s   b e s t   e f f o r t :   i t   m i g h t   b e   i g n o r e d   i f   t h e   s c h e d u l e r   d e t e r m i n e s   t h e   p o d   c a n n o t   g o   t o   a   n o m i n a t e d   n o d e .   A l s o ,   t h i s   f i e l d   c a n   b e   ( o v e r ) w r i t t e n   b y   t h e   s c h e d u l e r :   I f   t h e   s c h e d u l e r   f i n d s   a   n o d e   t o   n o m i n a t e   v i a   t h e   p r e e m p t i o n . I f   t h e   s c h e d u l e r   d e c i d e s   w h e r e   t h e   p o d   i s   g o i n g ,   a n d   m o v e   i t   t o   t h e   b i n d i n g   c y c l e . N o t e   t h a t ,   i n   t h i s   c a s e ,   n o m i n a t e d N o d e N a m e   i s   p u t   o n l y   w h e n   t h e   p o d   h a s   t o   g o   t h r o u g h   W a i t O n P e r m i t   o r   P r e B i n d   e x t e n s i o n   p o i n t s .   N o t e   t h a t ,   i n   t h i s   c a s e ,   n o m i n a t e d N o d e N a m e   i s   p u t   o n l y   w h e n   t h e   p o d   h a s   t o   g o   t h r o u g h   W a i t O n P e r m i t   o r   P r e B i n d   e x t e n s i o n   p o i n t s .   H e r e   i s   a n   e x a m p l e   o f   a   P o d   s t a t u s   u s i n g   t h e   n o m i n a t e d N o d e N a m e   f i e l d :   a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   n g i n x   . . .   s t a t u s :   n o m i n a t e d N o d e N a m e :   k u b e - 0 1


Question: What is Pod topology spread constraints?

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


Question: What is Operators?

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


Question: What is What's next?

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


Question: What is Init Containers?

Answer: Init ContainersThis page provides an overview of init containers: specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image.You can specify init containers in the Pod specification alongside the containers array (which describes app containers).In Kubernetes, a sidecar container is a container that starts before the main application container and continues to run. This document is about init containers: containers that run to completion during Pod initialization.Understanding init containersA Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.Init containers are exactly like regular containers, except:Init containers always run to completion.Each init container must complete successfully before the next one starts.If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.To specify an init container for a Pod, add the initContainers field into the Pod specification, as an array of container items (similar to the app containers field and its contents). See Container in the API reference for more details.The status of the init containers is returned in .status.initContainerStatuses field as an array of the container statuses (similar to the .status.containerStatuses field).Differences from regular containersInit containers support all the fields and features of app containers, including resource limits, volumes, and security settings. However, the resource requests and limits for an init container are handled differently, as documented in Resource sharing within containers.Regular init containers (in other words: excluding sidecar containers) do not support the lifecycle, livenessProbe, readinessProbe, or startupProbe fields. Init containers must run to completion before the Pod can be ready; sidecar containers continue running during a Pod's lifetime, and do support some probes. See sidecar container for further details about sidecar containers.If you specify multiple init containers for a Pod, kubelet runs each init container sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the Pod and runs them as usual.Differences from sidecar containersInit containers run and complete their tasks before the main application container starts. Unlike sidecar containers, init containers are not continuously running alongside the main containers.Init containers run to completion sequentially, and the main container does not start until all the init containers have successfully completed.init containers do not support lifecycle, livenessProbe, readines


Question: How does Init Containers work?

Answer: Init ContainersThis page provides an overview of init containers: specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image.You can specify init containers in the Pod specification alongside the containers array (which describes app containers).In Kubernetes, a sidecar container is a container that starts before the main application container and continues to run. This document is about init containers: containers that run to completion during Pod initialization.Understanding init containersA Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.Init containers are exactly like regular containers, except:Init containers always run to completion.Each init container must complete successfully before the next one starts.If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.To specify an init container for a Pod, add the initContainers field into the Pod specification, as an array of container items (similar to the app containers field and its contents). See Container in the API reference for more details.The status of the init containers is returned in .status.initContainerStatuses field as an array of the container statuses (similar to the .status.containerStatuses field).Differences from regular containersInit containers support all the fields and features of app containers, including resource limits, volumes, and security settings. However, the resource requests and limits for an init container are handled differently, as documented in Resource sharing within containers.Regular init containers (in other words: excluding sidecar containers) do not support the lifecycle, livenessProbe, readinessProbe, or startupProbe fields. Init containers must run to completion before the Pod can be ready; sidecar containers continue running during a Pod's lifetime, and do support some probes. See sidecar container for further details about sidecar containers.If you specify multiple init containers for a Pod, kubelet runs each init container sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the Pod and runs them as usual.Differences from sidecar containersInit containers run and complete their tasks before the main application container starts. Unlike sidecar containers, init containers are not continuously running alongside the main containers.Init containers run to completion sequentially, and the main container does not start until all the init containers have successfully completed.init containers do not support lifecycle, livenessProbe, readines


Question: When would you use Init Containers?

Answer: Init ContainersThis page provides an overview of init containers: specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image.You can specify init containers in the Pod specification alongside the containers array (which describes app containers).In Kubernetes, a sidecar container is a container that starts before the main application container and continues to run. This document is about init containers: containers that run to completion during Pod initialization.Understanding init containersA Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.Init containers are exactly like regular containers, except:Init containers always run to completion.Each init container must complete successfully before the next one starts.If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.To specify an init container for a Pod, add the initContainers field into the Pod specification, as an array of container items (similar to the app containers field and its contents). See Container in the API reference for more details.The status of the init containers is returned in .status.initContainerStatuses field as an array of the container statuses (similar to the .status.containerStatuses field).Differences from regular containersInit containers support all the fields and features of app containers, including resource limits, volumes, and security settings. However, the resource requests and limits for an init container are handled differently, as documented in Resource sharing within containers.Regular init containers (in other words: excluding sidecar containers) do not support the lifecycle, livenessProbe, readinessProbe, or startupProbe fields. Init containers must run to completion before the Pod can be ready; sidecar containers continue running during a Pod's lifetime, and do support some probes. See sidecar container for further details about sidecar containers.If you specify multiple init containers for a Pod, kubelet runs each init container sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the Pod and runs them as usual.Differences from sidecar containersInit containers run and complete their tasks before the main application container starts. Unlike sidecar containers, init containers are not continuously running alongside the main containers.Init containers run to completion sequentially, and the main container does not start until all the init containers have successfully completed.init containers do not support lifecycle, livenessProbe, readines


Question: What are the benefits of Init Containers?

Answer: Init ContainersThis page provides an overview of init containers: specialized containers that run before app containers in a Pod. Init containers can contain utilities or setup scripts not present in an app image.You can specify init containers in the Pod specification alongside the containers array (which describes app containers).In Kubernetes, a sidecar container is a container that starts before the main application container and continues to run. This document is about init containers: containers that run to completion during Pod initialization.Understanding init containersA Pod can have multiple containers running apps within it, but it can also have one or more init containers, which are run before the app containers are started.Init containers are exactly like regular containers, except:Init containers always run to completion.Each init container must complete successfully before the next one starts.If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.To specify an init container for a Pod, add the initContainers field into the Pod specification, as an array of container items (similar to the app containers field and its contents). See Container in the API reference for more details.The status of the init containers is returned in .status.initContainerStatuses field as an array of the container statuses (similar to the .status.containerStatuses field).Differences from regular containersInit containers support all the fields and features of app containers, including resource limits, volumes, and security settings. However, the resource requests and limits for an init container are handled differently, as documented in Resource sharing within containers.Regular init containers (in other words: excluding sidecar containers) do not support the lifecycle, livenessProbe, readinessProbe, or startupProbe fields. Init containers must run to completion before the Pod can be ready; sidecar containers continue running during a Pod's lifetime, and do support some probes. See sidecar container for further details about sidecar containers.If you specify multiple init containers for a Pod, kubelet runs each init container sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the Pod and runs them as usual.Differences from sidecar containersInit containers run and complete their tasks before the main application container starts. Unlike sidecar containers, init containers are not continuously running alongside the main containers.Init containers run to completion sequentially, and the main container does not start until all the init containers have successfully completed.init containers do not support lifecycle, livenessProbe, readines


Question: What is Init Containers?

Answer: T h i s   p a g e   p r o v i d e s   a n   o v e r v i e w   o f   i n i t   c o n t a i n e r s :   s p e c i a l i z e d   c o n t a i n e r s   t h a t   r u n   b e f o r e   a p p   c o n t a i n e r s   i n   a   P o d .   I n i t   c o n t a i n e r s   c a n   c o n t a i n   u t i l i t i e s   o r   s e t u p   s c r i p t s   n o t   p r e s e n t   i n   a n   a p p   i m a g e .   Y o u   c a n   s p e c i f y   i n i t   c o n t a i n e r s   i n   t h e   P o d   s p e c i f i c a t i o n   a l o n g s i d e   t h e   c o n t a i n e r s   a r r a y   ( w h i c h   d e s c r i b e s   a p p   c o n t a i n e r s ) .   I n   K u b e r n e t e s ,   a   s i d e c a r   c o n t a i n e r   i s   a   c o n t a i n e r   t h a t   s t a r t s   b e f o r e   t h e   m a i n   a p p l i c a t i o n   c o n t a i n e r   a n d   c o n t i n u e s   t o   r u n .   T h i s   d o c u m e n t   i s   a b o u t   i n i t   c o n t a i n e r s :   c o n t a i n e r s   t h a t   r u n   t o   c o m p l e t i o n   d u r i n g   P o d   i n i t i a l i z a t i o n .


Question: What is Understanding init containers?

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


Question: What is Differences from regular containers?

Answer: I n i t   c o n t a i n e r s   s u p p o r t   a l l   t h e   f i e l d s   a n d   f e a t u r e s   o f   a p p   c o n t a i n e r s ,   i n c l u d i n g   r e s o u r c e   l i m i t s ,   v o l u m e s ,   a n d   s e c u r i t y   s e t t i n g s .   H o w e v e r ,   t h e   r e s o u r c e   r e q u e s t s   a n d   l i m i t s   f o r   a n   i n i t   c o n t a i n e r   a r e   h a n d l e d   d i f f e r e n t l y ,   a s   d o c u m e n t e d   i n   R e s o u r c e   s h a r i n g   w i t h i n   c o n t a i n e r s .   R e g u l a r   i n i t   c o n t a i n e r s   ( i n   o t h e r   w o r d s :   e x c l u d i n g   s i d e c a r   c o n t a i n e r s )   d o   n o t   s u p p o r t   t h e   l i f e c y c l 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 ,   o r   s t a r t u p P r o b e   f i e l d s .   I n i t   c o n t a i n e r s   m u s t   r u n   t o   c o m p l e t i o n   b e f o r e   t h e   P o d   c a n   b e   r e a d y ;   s i d e c a r   c o n t a i n e r s   c o n t i n u e   r u n n i n g   d u r i n g   a   P o d ' s   l i f e t i m e ,   a n d   d o   s u p p o r t   s o m e   p r o b e s .   S e e   s i d e c a r   c o n t a i n e r   f o r   f u r t h e r   d e t a i l s   a b o u t   s i d e c a r   c o n t a i n e r s .   I f   y o u   s p e c i f y   m u l t i p l e   i n i t   c o n t a i n e r s   f o r   a   P o d ,   k u b e l e t   r u n s   e a c h   i n i t   c o n t a i n e r   s e q u e n t i a l l y .   E a c h   i n i t   c o n t a i n e r   m u s t   s u c c e e d   b e f o r e   t h e   n e x t   c a n   r u n .   W h e n   a l l   o f   t h e   i n i t   c o n t a i n e r s   h a v e   r u n   t o   c o m p l e t i o n ,   k u b e l e t   i n i t i a l i z e s   t h e   a p p l i c a t i o n   c o n t a i n e r s   f o r   t h e   P o d   a n d   r u n s   t h e m   a s   u s u a l .


Question: What is Differences from sidecar containers?

Answer: I n i t   c o n t a i n e r s   r u n   a n d   c o m p l e t e   t h e i r   t a s k s   b e f o r e   t h e   m a i n   a p p l i c a t i o n   c o n t a i n e r   s t a r t s .   U n l i k e   s i d e c a r   c o n t a i n e r s ,   i n i t   c o n t a i n e r s   a r e   n o t   c o n t i n u o u s l y   r u n n i n g   a l o n g s i d e   t h e   m a i n   c o n t a i n e r s .   I n i t   c o n t a i n e r s   r u n   t o   c o m p l e t i o n   s e q u e n t i a l l y ,   a n d   t h e   m a i n   c o n t a i n e r   d o e s   n o t   s t a r t   u n t i l   a l l   t h e   i n i t   c o n t a i n e r s   h a v e   s u c c e s s f u l l y   c o m p l e t e d .   i n i t   c o n t a i n e r s   d o   n o t   s u p p o r t   l i f e c y c l 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 ,   o r   s t a r t u p P r o b e   w h e r e a s   s i d e c a r   c o n t a i n e r s   s u p p o r t   a l l   t h e s e   p r o b e s   t o   c o n t r o l   t h e i r   l i f e c y c l e .   I n i t   c o n t a i n e r s   s h a r e   t h e   s a m e   r e s o u r c e s   ( C P U ,   m e m o r y ,   n e t w o r k )   w i t h   t h e   m a i n   a p p l i c a t i o n   c o n t a i n e r s   b u t   d o   n o t   i n t e r a c t   d i r e c t l y   w i t h   t h e m .   T h e y   c a n ,   h o w e v e r ,   u s e   s h a r e d   v o l u m e s   f o r   d a t a   e x c h a n g e .


Question: What is Using init containers?

Answer: B e c a u s e   i n i t   c o n t a i n e r s   h a v e   s e p a r a t e   i m a g e s   f r o m   a p p   c o n t a i n e r s ,   t h e y   h a v e   s o m e   a d v a n t a g e s   f o r   s t a r t - u p   r e l a t e d   c o d e :   I n i t   c o n t a i n e r s   c a n   c o n t a i n   u t i l i t i e s   o r   c u s t o m   c o d e   f o r   s e t u p   t h a t   a r e   n o t   p r e s e n t   i n   a n   a p p   i m a g e .   F o r   e x a m p l e ,   t h e r e   i s   n o   n e e d   t o   m a k e   a n   i m a g e   F R O M   a n o t h e r   i m a g e   j u s t   t o   u s e   a   t o o l   l i k e   s e d ,   a w k ,   p y t h o n ,   o r   d i g   d u r i n g   s e t u p . T h e   a p p l i c a t i o n   i m a g e   b u i l d e r   a n d   d e p l o y e r   r o l e s   c a n   w o r k   i n d e p e n d e n t l y   w i t h o u t   t h e   n e e d   t o   j o i n t l y   b u i l d   a   s i n g l e   a p p   i m a g e . I n i t   c o n t a i n e r s   c a n   r u n   w i t h   a   d i f f e r e n t   v i e w   o f   t h e   f i l e s y s t e m   t h a n   a p p   c o n t a i n e r s   i n   t h e   s a m e   P o d .   C o n s e q u e n t l y ,   t h e y   c a n   b e   g i v e n   a c c e s s   t o   S e c r e t s   t h a t   a p p   c o n t a i n e r s   c a n n o t   a c c e s s . B e c a u s e   i n i t   c o n t a i n e r s   r u n   t o   c o m p l e t i o n   b e f o r e   a n y   a p p   c o n t a i n e r s   s t a r t ,   i n i t   c o n t a i n e r s   o f f e r   a   m e c h a n i s m   t o   b l o c k   o r   d e l a y   a p p   c o n t a i n e r   s t a r t u p   u n t i l   a   s e t   o f   p r e c o n d i t i o n s   a r e   m e t .   O n c e   p r e c o n d i t i o n s   a r e   m e t ,   a l l   o f   t h e   a p p   c o n t a i n e r s   i n   a   P o d   c a n   s t a r t   i n   p a r a l l e l . I n i t   c o n t a i n e r s   c a n   s e c u r e l y   r u n   u t i l i t i e s   o r   c u s t o m   c o d e   t h a t   w o u l d   o


Question: What is Examples?

Answer: H e r e   a r e   s o m e   i d e a s   f o r   h o w   t o   u s e   i n i t   c o n t a i n e r s :   W a i t   f o r   a   S e r v i c e   t o   b e   c r e a t e d ,   u s i n g   a   s h e l l   o n e - l i n e   c o m m a n d   l i k e : f o r   i   i n   { 1 . . 1 0 0 } ;   d o   s l e e p   1 ;   i f   n s l o o k u p   m y s e r v i c e ;   t h e n   e x i t   0 ;   f i ;   d o n e ;   e x i t   1   R e g i s t e r   t h i s   P o d   w i t h   a   r e m o t e   s e r v e r   f r o m   t h e   d o w n w a r d   A P I   w i t h   a   c o m m a n d   l i k e : c u r l   - X   P O S T   h t t p : / / $ M A N A G E M E N T _ S E R V I C E _ H O S T : $ M A N A G E M E N T _ S E R V I C E _ P O R T / r e g i s t e r   - d   ' i n s t a n c e = $ ( < P O D _ N A M E > ) & i p = $ ( < P O D _ I P > ) '   W a i t   f o r   s o m e   t i m e   b e f o r e   s t a r t i n g   t h e   a p p   c o n t a i n e r   w i t h   a   c o m m a n d   l i k e s l e e p   6 0   C l o n e   a   G i t   r e p o s i t o r y   i n t o   a   V o l u m e P l a c e   v a l u e s   i n t o   a   c o n f i g u r a t i o n   f i l e   a n d   r u n   a   t e m p l a t e   t o o l   t o   d y n a m i c a l l y   g e n e r a t e   a   c o n f i g u r a t i o n   f i l e   f o r   t h e   m a i n   a p p   c o n t a i n e r .   F o r   e x a m p l e ,   p l a c e   t h e   P O D _ I P   v a l u e   i n   a   c o n f i g u r a t i o n   a n d   g e n e r a t e   t h e   m a i n   a p p   c o n f i g u r a t i o n   f i l e   u s i n g   J i n j a .   W a i t   f o r   a   S e r v i c e   t o   b e   c r e a t e d ,   u s i n g   a   s h e l l   o n e - l i n e   c o m m a n d   l i k e :   f o r   i   i n   { 1 . . 1 0 0 } ;   d o   s l e e p   1 ;   i f   n s l o o k u p   m y s e r v i c e ;   t h e n   e x i t   0 ;   f i ;   d o n e ;   e x i t   1   R e g i s t e r   t h i s   P o d   w i t h   a   r e m o t e   s e r v e r   f r o m   t h e   d o w n w a r d   A P I   w i t h   a   c o


Question: What is Init containers in use?

Answer: T h i s   e x a m p l e   d e f i n e s   a   s i m p l e   P o d   t h a t   h a s   t w o   i n i t   c o n t a i n e r s .   T h e   f i r s t   w a i t s   f o r   m y s e r v i c e ,   a n d   t h e   s e c o n d   w a i t s   f o r   m y d b .   O n c e   b o t h   i n i t   c o n t a i n e r s   c o m p l e t e ,   t h e   P o d   r u n s   t h e   a p p   c o n t a i n e r   f r o m   i t s   s p e c   s e c t i o n .   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 :   m y a p p - p o d   l a b e l 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   s p e c :   c o n t a i n e r s :   -   n a m e :   m y a p p - c o n t a i n e r   i m a g e :   b u s y b o x : 1 . 2 8   c o m m a n d :   [ ' s h ' ,   ' - c ' ,   ' e c h o   T h e   a p p   i s   r u n n i n g !   & &   s l e e p   3 6 0 0 ' ]   i n i t C o n t a i n e r s :   -   n a m e :   i n i t - m y s e r v i c e   i m a g e :   b u s y b o x : 1 . 2 8   c o m m a n d :   [ ' s h ' ,   ' - c ' ,   " u n t i l   n s l o o k u p   m y s e r v i c e . $ ( c a t   / v a r / r u n / s e c r e t s / k u b e r n e t e s . i o / s e r v i c e a c c o u n t / n a m e s p a c e ) . s v c . c l u s t e r . l o c a l ;   d o   e c h o   w a i t i n g   f o r   m y s e r v i c e ;   s l e e p   2 ;   d o n e " ]   -   n a m e :   i n i t - m y d b   i m a g e :   b u s y b o x : 1 . 2 8   c o m m a n d :   [ ' s h ' ,   ' - c ' ,   " u n t i l   n s l o o k u p   m y d b . $ ( c a t   / v a r / r u n / s e c r e t s / k u b e r n e t e s . i o / s e r v i c e a c c o u n t / n a m e s p a c e ) . s v c . c l u s t e r . l o c a l ;   d o   e c h o   w a i t i n g   f o r   m y d b ;   s l e e p   2 ;   d o n e " ]   Y o u   c a n   s t a r t   t h i s   P o d   b y   r u n n i n g :   k u b e c t l   a p p l y   - f   m y a p p . y a m l   T h e   o u t p u t   i s   s i m i l a r   t o   t h i s :   p o d / m y a p p - p o d   c r e a t e d   A n d   c h e c k   o n


Question: What is Detailed behavior?

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


Question: What is Resource sharing within containers?

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


Question: What is Init containers and Linux cgroups?

Answer: O n   L i n u x ,   r e s o u r c e   a l l o c a t i o n s   f o r   P o d   l e v e l   c o n t r o l   g r o u p s   ( c g r o u p s )   a r e   b a s e d   o n   t h e   e f f e c t i v e   P o d   r e q u e s t   a n d   l i m i t ,   t h e   s a m e   a s   t h e   s c h e d u l e r .


Question: What is Pod restart reasons?

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


Question: What is What's next?

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


Question: What is Run a Stateless Application Using a Deployment?

Answer: Run a Stateless Application Using a DeploymentThis page shows how to run an application using a Kubernetes Deployment object.ObjectivesCreate an nginx deployment.Use kubectl to list information about the deployment.Update the deployment.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 KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.Creating and exploring an nginx deploymentYou can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.14.2 Docker image:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Create a Deployment based on the YAML file:kubectl apply -f https://k8s.io/examples/application/deployment.yaml Display information about the Deployment:kubectl describe deployment nginx-deployment The output is similar to this:Name: nginx-deployment Namespace: default CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700 Labels: app=nginx Annotations: deployment.kubernetes.io/revision=1 Selector: app=nginx Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=nginx Containers: nginx: Image: nginx:1.14.2 Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created) No events. List the Pods created by the deployment:kubectl get pods -l app=nginx The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h nginx-deployment-1771418926-r18az 1/1 Running 0 16h Display information about a Pod:kubectl describe pod <pod-name> where <pod-name> is the name of one of your Pods.Updating the deploymentYou can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.16.1.application/deployment-update.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels


Question: How does Run a Stateless Application Using a Deployment work?

Answer: Run a Stateless Application Using a DeploymentThis page shows how to run an application using a Kubernetes Deployment object.ObjectivesCreate an nginx deployment.Use kubectl to list information about the deployment.Update the deployment.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 KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.Creating and exploring an nginx deploymentYou can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.14.2 Docker image:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Create a Deployment based on the YAML file:kubectl apply -f https://k8s.io/examples/application/deployment.yaml Display information about the Deployment:kubectl describe deployment nginx-deployment The output is similar to this:Name: nginx-deployment Namespace: default CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700 Labels: app=nginx Annotations: deployment.kubernetes.io/revision=1 Selector: app=nginx Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=nginx Containers: nginx: Image: nginx:1.14.2 Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created) No events. List the Pods created by the deployment:kubectl get pods -l app=nginx The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h nginx-deployment-1771418926-r18az 1/1 Running 0 16h Display information about a Pod:kubectl describe pod <pod-name> where <pod-name> is the name of one of your Pods.Updating the deploymentYou can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.16.1.application/deployment-update.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels


Question: When would you use Run a Stateless Application Using a Deployment?

Answer: Run a Stateless Application Using a DeploymentThis page shows how to run an application using a Kubernetes Deployment object.ObjectivesCreate an nginx deployment.Use kubectl to list information about the deployment.Update the deployment.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 KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.Creating and exploring an nginx deploymentYou can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.14.2 Docker image:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Create a Deployment based on the YAML file:kubectl apply -f https://k8s.io/examples/application/deployment.yaml Display information about the Deployment:kubectl describe deployment nginx-deployment The output is similar to this:Name: nginx-deployment Namespace: default CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700 Labels: app=nginx Annotations: deployment.kubernetes.io/revision=1 Selector: app=nginx Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=nginx Containers: nginx: Image: nginx:1.14.2 Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created) No events. List the Pods created by the deployment:kubectl get pods -l app=nginx The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h nginx-deployment-1771418926-r18az 1/1 Running 0 16h Display information about a Pod:kubectl describe pod <pod-name> where <pod-name> is the name of one of your Pods.Updating the deploymentYou can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.16.1.application/deployment-update.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels


Question: What are the benefits of Run a Stateless Application Using a Deployment?

Answer: Run a Stateless Application Using a DeploymentThis page shows how to run an application using a Kubernetes Deployment object.ObjectivesCreate an nginx deployment.Use kubectl to list information about the deployment.Update the deployment.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 KubernetesYour Kubernetes server must be at or later than version v1.9.To check the version, enter kubectl version.Creating and exploring an nginx deploymentYou can run an application by creating a Kubernetes Deployment object, and you can describe a Deployment in a YAML file. For example, this YAML file describes a Deployment that runs the nginx:1.14.2 Docker image:application/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Create a Deployment based on the YAML file:kubectl apply -f https://k8s.io/examples/application/deployment.yaml Display information about the Deployment:kubectl describe deployment nginx-deployment The output is similar to this:Name: nginx-deployment Namespace: default CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700 Labels: app=nginx Annotations: deployment.kubernetes.io/revision=1 Selector: app=nginx Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge Pod Template: Labels: app=nginx Containers: nginx: Image: nginx:1.14.2 Port: 80/TCP Environment: <none> Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created) No events. List the Pods created by the deployment:kubectl get pods -l app=nginx The output is similar to this:NAME READY STATUS RESTARTS AGE nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h nginx-deployment-1771418926-r18az 1/1 Running 0 16h Display information about a Pod:kubectl describe pod <pod-name> where <pod-name> is the name of one of your Pods.Updating the deploymentYou can update the deployment by applying a new YAML file. This YAML file specifies that the deployment should be updated to use nginx 1.16.1.application/deployment-update.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels


Question: What is Run a Stateless Application Using a Deployment?

Answer: T h i s   p a g e   s h o w s   h o w   t o   r u n   a n   a p p l i c a t i o n   u s i n g   a   K u b e r n e t e s   D e p l o y m e n t   o b j e c t .


Question: What is Objectives?

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


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 r   K u b e r n e t e s   s e r v e r   m u s t   b e   a t   o r   l a t e r   t h a n   v e r s i o n   v 1 . 9 . T o   c h e c k   t h e   v e r s i o n ,   e n t e r   k u b e c t l   v e r s i o n .   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   T o   c h e c k   t h e   v e r s i o n ,   e n t e r   k u b e c t l   v e r s i o n .


Question: What is Creating and exploring an nginx deployment?

Answer: Y o u   c a n   r u n   a n   a p p l i c a t i o n   b y   c r e a t i n g   a   K u b e r n e t e s   D e p l o y m e n t   o b j e c t ,   a n d   y o u   c a n   d e s c r i b e   a   D e p l o y m e n t   i n   a   Y A M L   f i l e .   F o r   e x a m p l e ,   t h i s   Y A M L   f i l e   d e s c r i b e s   a   D e p l o y m e n t   t h a t   r u n s   t h e   n g i n x : 1 . 1 4 . 2   D o c k e r   i m a g e :   a p i V e r s i o n :   a p p s / v 1   k i n d :   D e p l o y m e n t   m e t a d a t a :   n a m e :   n g i n x - d e p l o y m e n t   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 :   n g i n x   r e p l i c a s :   2   #   t e l l s   d e p l o y m e n t   t o   r u n   2   p o d s   m a t c h i n g   t h e   t e m p l a t e   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 :   n g i n x   s p e c :   c o n t a i n e r s :   -   n a m e :   n g i n x   i m a g e :   n g i n x : 1 . 1 4 . 2   p o r t s :   -   c o n t a i n e r P o r t :   8 0   C r e a t e   a   D e p l o y m e n t   b a s e d   o n   t h e   Y A M L   f i l 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 p p l i c a t i o n / d e p l o y m e n t . y a m l   D i s p l a y   i n f o r m a t i o n   a b o u t   t h e   D e p l o y m e n t : k u b e c t l   d e s c r i b e   d e p l o y m e n t   n g i n x - d e p l o y m e n t   T h e   o u t p u t   i s   s i m i l a r   t o   t h i s : N a m e :   n g i n x - d e p l o y m e n t   N a m e s p a c e :   d e f a u l t   C r e a t i o n T i m e s t a m p :   T u e ,   3 0   A u g   2 0 1 6   1 8 : 1 1 : 3 7   - 0 7 0 0   L a b e l s :   a p p = n g i n x   A n n o t a t i o n s :   d e p l o y m e n t . k u b e r n e t e s . i o / r e v i s i o n = 1   S e l e c t o r :   a p p = n g i n x   R e p l i c a s :   2   d e s i r e d   |   2   u p d a t e d   |   2   t o t a l   |   2   a v a i l a b l e   |   0   u n a v a i l a b l e   S t r a t e g y T y p e


Question: What is Updating the deployment?

Answer: Y o u   c a n   u p d a t e   t h e   d e p l o y m e n t   b y   a p p l y i n g   a   n e w   Y A M L   f i l e .   T h i s   Y A M L   f i l e   s p e c i f i e s   t h a t   t h e   d e p l o y m e n t   s h o u l d   b e   u p d a t e d   t o   u s e   n g i n x   1 . 1 6 . 1 .   a p i V e r s i o n :   a p p s / v 1   k i n d :   D e p l o y m e n t   m e t a d a t a :   n a m e :   n g i n x - d e p l o y m e n t   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 :   n g i n x   r e p l i c a s :   2   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 :   n g i n x   s p e c :   c o n t a i n e r s :   -   n a m e :   n g i n x   i m a g e :   n g i n x : 1 . 1 6 . 1   #   U p d a t e   t h e   v e r s i o n   o f   n g i n x   f r o m   1 . 1 4 . 2   t o   1 . 1 6 . 1   p o r t s :   -   c o n t a i n e r P o r t :   8 0   A p p l y   t h e   n e w   Y A M L   f i l 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 p p l i c a t i o n / d e p l o y m e n t - u p d a t e . y a m l   W a t c h   t h e   d e p l o y m e n t   c r e a t e   p o d s   w i t h   n e w   n a m e s   a n d   d e l e t e   t h e   o l d   p o d s : k u b e c t l   g e t   p o d s   - l   a p p = n g i n x   A p p l y   t h e   n e w   Y A M L   f i l 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 p p l i c a t i o n / d e p l o y m e n t - u p d a t e . y a m l   W a t c h   t h e   d e p l o y m e n t   c r e a t e   p o d s   w i t h   n e w   n a m e s   a n d   d e l e t e   t h e   o l d   p o d s :   k u b e c t l   g e t   p o d s   - l   a p p = n g i n x


Question: What is Scaling the application by increasing the replica count?

Answer: Y o u   c a n   i n c r e a s e   t h e   n u m b e r   o f   P o d s   i n   y o u r   D e p l o y m e n t   b y   a p p l y i n g   a   n e w   Y A M L   f i l e .   T h i s   Y A M L   f i l e   s e t s   r e p l i c a s   t o   4 ,   w h i c h   s p e c i f i e s   t h a t   t h e   D e p l o y m e n t   s h o u l d   h a v e   f o u r   P o d s :   a p i V e r s i o n :   a p p s / v 1   k i n d :   D e p l o y m e n t   m e t a d a t a :   n a m e :   n g i n x - d e p l o y m e n t   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 :   n g i n x   r e p l i c a s :   4   #   U p d a t e   t h e   r e p l i c a s   f r o m   2   t o   4   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 :   n g i n x   s p e c :   c o n t a i n e r s :   -   n a m e :   n g i n x   i m a g e :   n g i n x : 1 . 1 6 . 1   p o r t s :   -   c o n t a i n e r P o r t :   8 0   A p p l y   t h e   n e w   Y A M L   f i l 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 p p l i c a t i o n / d e p l o y m e n t - s c a l e . y a m l   V e r i f y   t h a t   t h e   D e p l o y m e n t   h a s   f o u r   P o d s : k u b e c t l   g e t   p o d s   - l   a p p = n g i n x   T h e   o u t p u t   i s   s i m i l a r   t o   t h i s : 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   n g i n x - d e p l o y m e n t - 1 4 8 8 8 0 5 9 5 - 4 z d q q   1 / 1   R u n n i n g   0   2 5 s   n g i n x - d e p l o y m e n t - 1 4 8 8 8 0 5 9 5 - 6 z g i 1   1 / 1   R u n n i n g   0   2 5 s   n g i n x - d e p l o y m e n t - 1 4 8 8 8 0 5 9 5 - f x c e z   1 / 1   R u n n i n g   0   2 m   n g i n x - d e p l o y m e n t - 1 4 8 8 8 0 5 9 5 - r w o v n   1 / 1   R u n n i n g   0   2 m   A p p l y   t h e   n e w   Y A M L   f i l 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 p p l i c a t i o n / d e p l o y m e n t - s c a l e . y a m l   V e r i f y   t h a t   t h e


Question: What is Deleting a deployment?

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


Question: What is ReplicationControllers -- the Old Way?

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


Question: What is What's next?

Answer: L e a r n   m o r e   a b o u t   D e p l o y m e n t   o b j e c t s .


Question: What is Job with Pod-to-Pod Communication?

Answer: Job with Pod-to-Pod CommunicationIn this example, you will run a Job in Indexed completion mode configured such that the pods created by the Job can communicate with each other using pod hostnames rather than pod IP addresses.Pods within a Job might need to communicate among themselves. The user workload running in each pod could query the Kubernetes API server to learn the IPs of the other Pods, but it's much simpler to rely on Kubernetes' built-in DNS resolution.Jobs in Indexed completion mode automatically set the pods' hostname to be in the format of ${jobName}-${completionIndex}. You can use this format to deterministically build pod hostnames and enable pod communication without needing to create a client connection to the Kubernetes control plane to obtain pod hostnames/IPs via API requests.This configuration is useful for use cases where pod networking is required but you don't want to depend on a network connection with the Kubernetes API server.Before you beginYou should already be familiar with the basic use of Job.You 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 KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Note:If you are using minikube or a similar tool, you may need to take extra steps to ensure you have DNS.Starting a Job with pod-to-pod communicationTo enable pod-to-pod communication using pod hostnames in a Job, you must do the following:Set up a headless Service with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as the Job. One easy way to do this is to use the job-name: <your-job-name> selector, since the job-name label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of the pods running your Job.Configure the headless service as subdomain service for the Job pods by including the following value in your Job template spec:subdomain: <headless-svc-name> ExampleBelow is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.Note:In the Bash script executed on each pod in the example below, the pod hostnames can be prefixed by the namespace as well if the pod needs to be reached from outside the namespace.apiVersion: v1 kind: Service metadata: name: headless-svc spec: clusterIP: None # clusterIP must be None to create a headless service selector: job-name: example-job # must match Job name --- apiVersion: batch/v1 kind: Job metadata: name: example-job spec


Question: How does Job with Pod-to-Pod Communication work?

Answer: Job with Pod-to-Pod CommunicationIn this example, you will run a Job in Indexed completion mode configured such that the pods created by the Job can communicate with each other using pod hostnames rather than pod IP addresses.Pods within a Job might need to communicate among themselves. The user workload running in each pod could query the Kubernetes API server to learn the IPs of the other Pods, but it's much simpler to rely on Kubernetes' built-in DNS resolution.Jobs in Indexed completion mode automatically set the pods' hostname to be in the format of ${jobName}-${completionIndex}. You can use this format to deterministically build pod hostnames and enable pod communication without needing to create a client connection to the Kubernetes control plane to obtain pod hostnames/IPs via API requests.This configuration is useful for use cases where pod networking is required but you don't want to depend on a network connection with the Kubernetes API server.Before you beginYou should already be familiar with the basic use of Job.You 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 KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Note:If you are using minikube or a similar tool, you may need to take extra steps to ensure you have DNS.Starting a Job with pod-to-pod communicationTo enable pod-to-pod communication using pod hostnames in a Job, you must do the following:Set up a headless Service with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as the Job. One easy way to do this is to use the job-name: <your-job-name> selector, since the job-name label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of the pods running your Job.Configure the headless service as subdomain service for the Job pods by including the following value in your Job template spec:subdomain: <headless-svc-name> ExampleBelow is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.Note:In the Bash script executed on each pod in the example below, the pod hostnames can be prefixed by the namespace as well if the pod needs to be reached from outside the namespace.apiVersion: v1 kind: Service metadata: name: headless-svc spec: clusterIP: None # clusterIP must be None to create a headless service selector: job-name: example-job # must match Job name --- apiVersion: batch/v1 kind: Job metadata: name: example-job spec


Question: When would you use Job with Pod-to-Pod Communication?

Answer: Job with Pod-to-Pod CommunicationIn this example, you will run a Job in Indexed completion mode configured such that the pods created by the Job can communicate with each other using pod hostnames rather than pod IP addresses.Pods within a Job might need to communicate among themselves. The user workload running in each pod could query the Kubernetes API server to learn the IPs of the other Pods, but it's much simpler to rely on Kubernetes' built-in DNS resolution.Jobs in Indexed completion mode automatically set the pods' hostname to be in the format of ${jobName}-${completionIndex}. You can use this format to deterministically build pod hostnames and enable pod communication without needing to create a client connection to the Kubernetes control plane to obtain pod hostnames/IPs via API requests.This configuration is useful for use cases where pod networking is required but you don't want to depend on a network connection with the Kubernetes API server.Before you beginYou should already be familiar with the basic use of Job.You 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 KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Note:If you are using minikube or a similar tool, you may need to take extra steps to ensure you have DNS.Starting a Job with pod-to-pod communicationTo enable pod-to-pod communication using pod hostnames in a Job, you must do the following:Set up a headless Service with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as the Job. One easy way to do this is to use the job-name: <your-job-name> selector, since the job-name label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of the pods running your Job.Configure the headless service as subdomain service for the Job pods by including the following value in your Job template spec:subdomain: <headless-svc-name> ExampleBelow is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.Note:In the Bash script executed on each pod in the example below, the pod hostnames can be prefixed by the namespace as well if the pod needs to be reached from outside the namespace.apiVersion: v1 kind: Service metadata: name: headless-svc spec: clusterIP: None # clusterIP must be None to create a headless service selector: job-name: example-job # must match Job name --- apiVersion: batch/v1 kind: Job metadata: name: example-job spec


Question: What are the benefits of Job with Pod-to-Pod Communication?

Answer: Job with Pod-to-Pod CommunicationIn this example, you will run a Job in Indexed completion mode configured such that the pods created by the Job can communicate with each other using pod hostnames rather than pod IP addresses.Pods within a Job might need to communicate among themselves. The user workload running in each pod could query the Kubernetes API server to learn the IPs of the other Pods, but it's much simpler to rely on Kubernetes' built-in DNS resolution.Jobs in Indexed completion mode automatically set the pods' hostname to be in the format of ${jobName}-${completionIndex}. You can use this format to deterministically build pod hostnames and enable pod communication without needing to create a client connection to the Kubernetes control plane to obtain pod hostnames/IPs via API requests.This configuration is useful for use cases where pod networking is required but you don't want to depend on a network connection with the Kubernetes API server.Before you beginYou should already be familiar with the basic use of Job.You 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 KubernetesYour Kubernetes server must be at or later than version v1.21.To check the version, enter kubectl version.Note:If you are using minikube or a similar tool, you may need to take extra steps to ensure you have DNS.Starting a Job with pod-to-pod communicationTo enable pod-to-pod communication using pod hostnames in a Job, you must do the following:Set up a headless Service with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as the Job. One easy way to do this is to use the job-name: <your-job-name> selector, since the job-name label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of the pods running your Job.Configure the headless service as subdomain service for the Job pods by including the following value in your Job template spec:subdomain: <headless-svc-name> ExampleBelow is a working example of a Job with pod-to-pod communication via pod hostnames enabled. The Job is completed only after all pods successfully ping each other using hostnames.Note:In the Bash script executed on each pod in the example below, the pod hostnames can be prefixed by the namespace as well if the pod needs to be reached from outside the namespace.apiVersion: v1 kind: Service metadata: name: headless-svc spec: clusterIP: None # clusterIP must be None to create a headless service selector: job-name: example-job # must match Job name --- apiVersion: batch/v1 kind: Job metadata: name: example-job spec


Question: What is Job with Pod-to-Pod Communication?

Answer: I n   t h i s   e x a m p l e ,   y o u   w i l l   r u n   a   J o b   i n   I n d e x e d   c o m p l e t i o n   m o d e   c o n f i g u r e d   s u c h   t h a t   t h e   p o d s   c r e a t e d   b y   t h e   J o b   c a n   c o m m u n i c a t e   w i t h   e a c h   o t h e r   u s i n g   p o d   h o s t n a m e s   r a t h e r   t h a n   p o d   I P   a d d r e s s e s .   P o d s   w i t h i n   a   J o b   m i g h t   n e e d   t o   c o m m u n i c a t e   a m o n g   t h e m s e l v e s .   T h e   u s e r   w o r k l o a d   r u n n i n g   i n   e a c h   p o d   c o u l d   q u e r y   t h e   K u b e r n e t e s   A P I   s e r v e r   t o   l e a r n   t h e   I P s   o f   t h e   o t h e r   P o d s ,   b u t   i t ' s   m u c h   s i m p l e r   t o   r e l y   o n   K u b e r n e t e s '   b u i l t - i n   D N S   r e s o l u t i o n .   J o b s   i n   I n d e x e d   c o m p l e t i o n   m o d e   a u t o m a t i c a l l y   s e t   t h e   p o d s '   h o s t n a m e   t o   b e   i n   t h e   f o r m a t   o f   $ { j o b N a m e } - $ { c o m p l e t i o n I n d e x } .   Y o u   c a n   u s e   t h i s   f o r m a t   t o   d e t e r m i n i s t i c a l l y   b u i l d   p o d   h o s t n a m e s   a n d   e n a b l e   p o d   c o m m u n i c a t i o n   w i t h o u t   n e e d i n g   t o   c r e a t e   a   c l i e n t   c o n n e c t i o n   t o   t h e   K u b e r n e t e s   c o n t r o l   p l a n e   t o   o b t a i n   p o d   h o s t n a m e s / I P s   v i a   A P I   r e q u e s t s .   T h i s   c o n f i g u r a t i o n   i s   u s e f u l   f o r   u s e   c a s e s   w h e r e   p o d   n e t w o r k i n g   i s   r e q u i r e d   b u t   y o u   d o n ' t   w a n t   t o   d e p e n d   o n   a   n e t w o r k   c o n n e c t i o n   w i t h   t h e   K u b e r n e t e s   A P I   s e r v e r .


Question: What is Before you begin?

Answer: Y o u   s h o u l d   a l r e a d y   b e   f a m i l i a r   w i t h   t h e   b a s i c   u s e   o f   J o b .   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 r   K u b e r n e t e s   s e r v e r   m u s t   b e   a t   o r   l a t e r   t h a n   v e r s i o n   v 1 . 2 1 . T o   c h e c k   t h e   v e r s i o n ,   e n t e r   k u b e c t l   v e r s i o n .   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


Question: What is Starting a Job with pod-to-pod communication?

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


Question: What is Example?

Answer: B e l o w   i s   a   w o r k i n g   e x a m p l e   o f   a   J o b   w i t h   p o d - t o - p o d   c o m m u n i c a t i o n   v i a   p o d   h o s t n a m e s   e n a b l e d .   T h e   J o b   i s   c o m p l e t e d   o n l y   a f t e r   a l l   p o d s   s u c c e s s f u l l y   p i n g   e a c h   o t h e r   u s i n g   h o s t n a m e s .


Question: What is Note:?

Answer: 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 :   h e a d l e s s - s v c   s p e c :   c l u s t e r I P :   N o n e   #   c l u s t e r I P   m u s t   b e   N o n e   t o   c r e a t e   a   h e a d l e s s   s e r v i c e   s e l e c t o r :   j o b - n a m e :   e x a m p l e - j o b   #   m u s t   m a t c h   J o b   n a m e   - - -   a p i V e r s i o n :   b a t c h / v 1   k i n d :   J o b   m e t a d a t a :   n a m e :   e x a m p l e - j o b   s p e c :   c o m p l e t i o n s :   3   p a r a l l e l i s m :   3   c o m p l e t i o n M o d e :   I n d e x e d   t e m p l a t e :   s p e c :   s u b d o m a i n :   h e a d l e s s - s v c   #   h a s   t o   m a t c h   S e r v i c e   n a m e   r e s t a r t P o l i c y :   N e v e r   c o n t a i n e r s :   -   n a m e :   e x a m p l e - w o r k l o a d   i m a g e :   b a s h : l a t e s t   c o m m a n d :   -   b a s h   -   - c   -   |   f o r   i   i n   0   1   2   d o   g o t S t a t u s = " - 1 "   w a n t S t a t u s = " 0 "   w h i l e   [   $ g o t S t a t u s   - n e   $ w a n t S t a t u s   ]   d o   p i n g   - c   1   e x a m p l e - j o b - $ { i } . h e a d l e s s - s v c   >   / d e v / n u l l   2 > & 1   g o t S t a t u s = $ ?   i f   [   $ g o t S t a t u s   - n e   $ w a n t S t a t u s   ] ;   t h e n   e c h o   " F a i l e d   t o   p i n g   p o d   e x a m p l e - j o b - $ { i } . h e a d l e s s - s v c ,   r e t r y i n g   i n   1   s e c o n d . . . "   s l e e p   1   f i   d o n e   e c h o   " S u c c e s s f u l l y   p i n g e d   p o d :   e x a m p l e - j o b - $ { i } . h e a d l e s s - s v c "   d o n e   A f t e r   a p p l y i n g   t h e   e x a m p l e   a b o v e ,   r e a c h   e a c h   o t h e r   o v e r   t h e   n e t w o r k   u s i n g :   < p o d - h o s t n a m e > . < h e a d l e s s - s e r v i c e - n a m e > .   Y o u   s h o u l d   s e e   o u t p u t   s i m i l a r   t o   t h e   f o l l o


Question: What is kubectl delete?

Answer: kubectl deleteSynopsisDelete resources by file names, stdin, resources and names, or by resources and label selector.JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run "kubectl api-resources" to refresh the discovery cache.kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names "baz" and "foo" kubectl delete pod,service baz foo # Delete pods and services with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # D


Question: How does kubectl delete work?

Answer: kubectl deleteSynopsisDelete resources by file names, stdin, resources and names, or by resources and label selector.JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run "kubectl api-resources" to refresh the discovery cache.kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names "baz" and "foo" kubectl delete pod,service baz foo # Delete pods and services with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # D


Question: When would you use kubectl delete?

Answer: kubectl deleteSynopsisDelete resources by file names, stdin, resources and names, or by resources and label selector.JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run "kubectl api-resources" to refresh the discovery cache.kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names "baz" and "foo" kubectl delete pod,service baz foo # Delete pods and services with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # D


Question: What are the benefits of kubectl delete?

Answer: kubectl deleteSynopsisDelete resources by file names, stdin, resources and names, or by resources and label selector.JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.Some resources, such as pods, support graceful deletion. These resources define a default period before they are forcibly terminated (the grace period) but you may override that value with the --grace-period flag, or pass --now to set a grace-period of 1. Because these resources often represent entities in the cluster, deletion may not be acknowledged immediately. If the node hosting a pod is down or cannot reach the API server, termination may take significantly longer than the grace period. To force delete a resource, you must specify the --force flag. Note: only a subset of resources support graceful deletion. In absence of the support, the --grace-period flag is ignored.IMPORTANT: Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods, the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.Note that the delete command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a delete, their update will be lost along with the rest of the resource.After a CustomResourceDefinition is deleted, invalidation of discovery cache may take up to 6 hours. If you don't want to wait, you might want to run "kubectl api-resources" to refresh the discovery cache.kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)]) Examples # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete resources from all files that end with '.json' kubectl delete -f '*.json' # Delete a pod based on the type and name in the JSON passed into stdin cat pod.json | kubectl delete -f - # Delete pods and services with same names "baz" and "foo" kubectl delete pod,service baz foo # Delete pods and services with label name=myLabel kubectl delete pods,services -l name=myLabel # Delete a pod with minimal delay kubectl delete pod foo --now # Force delete a pod on a dead node kubectl delete pod foo --force # D


Question: What is Synopsis?

Answer: D e l e t e   r e s o u r c e s   b y   f i l e   n a m e s ,   s t d i n ,   r e s o u r c e s   a n d   n a m e s ,   o r   b y   r e s o u r c e s   a n d   l a b e l   s e l e c t o r .   J S O N   a n d   Y A M L   f o r m a t s   a r e   a c c e p t e d .   O n l y   o n e   t y p e   o f   a r g u m e n t   m a y   b e   s p e c i f i e d :   f i l e   n a m e s ,   r e s o u r c e s   a n d   n a m e s ,   o r   r e s o u r c e s   a n d   l a b e l   s e l e c t o r .   S o m e   r e s o u r c e s ,   s u c h   a s   p o d s ,   s u p p o r t   g r a c e f u l   d e l e t i o n .   T h e s e   r e s o u r c e s   d e f i n e   a   d e f a u l t   p e r i o d   b e f o r e   t h e y   a r e   f o r c i b l y   t e r m i n a t e d   ( t h e   g r a c e   p e r i o d )   b u t   y o u   m a y   o v e r r i d e   t h a t   v a l u e   w i t h   t h e   - - g r a c e - p e r i o d   f l a g ,   o r   p a s s   - - n o w   t o   s e t   a   g r a c e - p e r i o d   o f   1 .   B e c a u s e   t h e s e   r e s o u r c e s   o f t e n   r e p r e s e n t   e n t i t i e s   i n   t h e   c l u s t e r ,   d e l e t i o n   m a y   n o t   b e   a c k n o w l e d g e d   i m m e d i a t e l y .   I f   t h e   n o d e   h o s t i n g   a   p o d   i s   d o w n   o r   c a n n o t   r e a c h   t h e   A P I   s e r v e r ,   t e r m i n a t i o n   m a y   t a k e   s i g n i f i c a n t l y   l o n g e r   t h a n   t h e   g r a c e   p e r i o d .   T o   f o r c e   d e l e t e   a   r e s o u r c e ,   y o u   m u s t   s p e c i f y   t h e   - - f o r c e   f l a g .   N o t e :   o n l y   a   s u b s e t   o f   r e s o u r c e s   s u p p o r t   g r a c e f u l   d e l e t i o n .   I n   a b s e n c e   o f   t h e   s u p p o r t ,   t h e   - - g r a c e - p e r i o d   f l a g   i s   i g n o r e d .   I M P O R T A N T :   F o r c e   d e l e t i n g   p o d s   d o e s   n o t   w a i t   f o r   c o n f i r m a t i o n   t h a t   t h e   p o d


Question: What is Examples?

Answer: #   D e l e t e   a   p o d   u s i n g   t h e   t y p e   a n d   n a m e   s p e c i f i e d   i n   p o d . j s o n   k u b e c t l   d e l e t e   - f   . / p o d . j s o n   #   D e l e t e   r e s o u r c e s   f r o m   a   d i r e c t o r y   c o n t a i n i n g   k u s t o m i z a t i o n . y a m l   -   e . g .   d i r / k u s t o m i z a t i o n . y a m l   k u b e c t l   d e l e t e   - k   d i r   #   D e l e t e   r e s o u r c e s   f r o m   a l l   f i l e s   t h a t   e n d   w i t h   ' . j s o n '   k u b e c t l   d e l e t e   - f   ' * . j s o n '   #   D e l e t e   a   p o d   b a s e d   o n   t h e   t y p e   a n d   n a m e   i n   t h e   J S O N   p a s s e d   i n t o   s t d i n   c a t   p o d . j s o n   |   k u b e c t l   d e l e t e   - f   -   #   D e l e t e   p o d s   a n d   s e r v i c e s   w i t h   s a m e   n a m e s   " b a z "   a n d   " f o o "   k u b e c t l   d e l e t e   p o d , s e r v i c e   b a z   f o o   #   D e l e t e   p o d s   a n d   s e r v i c e s   w i t h   l a b e l   n a m e = m y L a b e l   k u b e c t l   d e l e t e   p o d s , s e r v i c e s   - l   n a m e = m y L a b e l   #   D e l e t e   a   p o d   w i t h   m i n i m a l   d e l a y   k u b e c t l   d e l e t e   p o d   f o o   - - n o w   #   F o r c e   d e l e t e   a   p o d   o n   a   d e a d   n o d e   k u b e c t l   d e l e t e   p o d   f o o   - - f o r c e   #   D e l e t e   a l l   p o d s   k u b e c t l   d e l e t e   p o d s   - - a l l   #   D e l e t e   a l l   p o d s   o n l y   i f   t h e   u s e r   c o n f i r m s   t h e   d e l e t i o n   k u b e c t l   d e l e t e   p o d s   - - a l l   - - i n t e r a c t i v e


Question: What is Options?

Answer: D e l e t e   a l l   r e s o u r c e s ,   i n   t h e   n a m e s p a c e   o f   t h e   s p e c i f i e d   r e s o u r c e   t y p e s .   I f   p r e s e n t ,   l i s t   t h e   r e q u e s t e d   o b j e c t ( s )   a c r o s s   a l l   n a m e s p a c e s .   N a m e s p a c e   i n   c u r r e n t   c o n t e x t   i s   i g n o r e d   e v e n   i f   s p e c i f i e d   w i t h   - - n a m e s p a c e .   M u s t   b e   " b a c k g r o u n d " ,   " o r p h a n " ,   o r   " f o r e g r o u n d " .   S e l e c t s   t h e   d e l e t i o n   c a s c a d i n g   s t r a t e g y   f o r   t h e   d e p e n d e n t s   ( e . g .   P o d s   c r e a t e d   b y   a   R e p l i c a t i o n C o n t r o l l e r ) .   D e f a u l t s   t o   b a c k g r o u n d .   M u s t   b e   " n o n e " ,   " s e r v e r " ,   o r   " c l i e n t " .   I f   c l i e n t   s t r a t e g y ,   o n l y   p r i n t   t h e   o b j e c t   t h a t   w o u l d   b e   s e n t ,   w i t h o u t   s e n d i n g   i t .   I f   s e r v e r   s t r a t e g y ,   s u b m i t   s e r v e r - s i d e   r e q u e s t   w i t h o u t   p e r s i s t i n g   t h e   r e s o u r c e .   S e l e c t o r   ( f i e l d   q u e r y )   t o   f i l t e r   o n ,   s u p p o r t s   ' = ' ,   ' = = ' ,   a n d   ' ! = ' . ( e . g .   - - f i e l d - s e l e c t o r   k e y 1 = v a l u e 1 , k e y 2 = v a l u e 2 ) .   T h e   s e r v e r   o n l y   s u p p o r t s   a   l i m i t e d   n u m b e r   o f   f i e l d   q u e r i e s   p e r   t y p e .   c o n t a i n i n g   t h e   r e s o u r c e   t o   d e l e t e .   I f   t r u e ,   i m m e d i a t e l y   r e m o v e   r e s o u r c e s   f r o m   A P I   a n d   b y p a s s   g r a c e f u l   d e l e t i o n .   N o t e   t h a t   i m m e d i a t e   d e l e t i o n   o f   s o m e   r e s o u r c e s   m a y   r e s u l t   i n   i n c o n s i s t e n c y   o r   d a t a   l o s s   a n d   r e q u i r e s   c o n f i r m a t i