Question: What is Note:?

Answer: I n   s o m e   c a s e s ,   p o d   e v i c t i o n   o n l y   r e c l a i m s   a   s m a l l   a m o u n t   o f   t h e   s t a r v e d   r e s o u r c e .   T h i s   c a n   l e a d   t o   t h e   k u b e l e t   r e p e a t e d l y   h i t t i n g   t h e   c o n f i g u r e d   e v i c t i o n   t h r e s h o l d s   a n d   t r i g g e r i n g   m u l t i p l e   e v i c t i o n s .   Y o u   c a n   u s e   t h e   - - e v i c t i o n - m i n i m u m - r e c l a i m   f l a g   o r   a   k u b e l e t   c o n f i g   f i l e   t o   c o n f i g u r e   a   m i n i m u m   r e c l a i m   a m o u n t   f o r   e a c h   r e s o u r c e .   W h e n   t h e   k u b e l e t   n o t i c e s   t h a t   a   r e s o u r c e   i s   s t a r v e d ,   i t   c o n t i n u e s   t o   r e c l a i m   t h a t   r e s o u r c e   u n t i l   i t   r e c l a i m s   t h e   q u a n t i t y   y o u   s p e c i f y .   F o r   e x a m p l e ,   t h e   f o l l o w i n g   c o n f i g u r a t i o n   s e t s   m i n i m u m   r e c l a i m   a m o u n t s :   a p i V e r s i o n :   k u b e l e t . c o n f i g . k 8 s . i o / v 1 b e t a 1   k i n d :   K u b e l e t C o n f i g u r a t i o n   e v i c t i o n H a r d :   m e m o r y . a v a i l a b l e :   " 5 0 0 M i "   n o d e f s . a v a i l a b l e :   " 1 G i "   i m a g e f s . a v a i l a b l e :   " 1 0 0 G i "   e v i c t i o n M i n i m u m R e c l a i m :   m e m o r y . a v a i l a b l e :   " 0 M i "   n o d e f s . a v a i l a b l e :   " 5 0 0 M i "   i m a g e f s . a v a i l a b l e :   " 2 G i "   I n   t h i s   e x a m p l e ,   i f   t h e   n o d e f s . a v a i l a b l e   s i g n a l   m e e t s   t h e   e v i c t i o n   t h r e s h o l d ,   t h e   k u b e l e t   r e c l a i m s   t h e   r e s o u r c e   u n t i l   t h e   s i g n a l   r e a c h e s   t h e   t h r e s h o l d   o f   1 G i B ,   a n d   t h e n   c o n t i n u e s   t o   r e c l a i m   t h e   m i n i m u m   a m o


Question: What is Node out of memory behavior?

Answer: I f   t h e   n o d e   e x p e r i e n c e s   a n   o u t   o f   m e m o r y   ( O O M )   e v e n t   p r i o r   t o   t h e   k u b e l e t   b e i n g   a b l e   t o   r e c l a i m   m e m o r y ,   t h e   n o d e   d e p e n d s   o n   t h e   o o m _ k i l l e r   t o   r e s p o n d .   T h e   k u b e l e t   s e t s   a n   o o m _ s c o r e _ a d j   v a l u e   f o r   e a c h   c o n t a i n e r   b a s e d   o n   t h e   Q o S   f o r   t h e   p o d .


Question: What is Note:?

Answer: I f   t h e   k u b e l e t   c a n ' t   r e c l a i m   m e m o r y   b e f o r e   a   n o d e   e x p e r i e n c e s   O O M ,   t h e   o o m _ k i l l e r   c a l c u l a t e s   a n   o o m _ s c o r e   b a s e d   o n   t h e   p e r c e n t a g e   o f   m e m o r y   i t ' s   u s i n g   o n   t h e   n o d e ,   a n d   t h e n   a d d s   t h e   o o m _ s c o r e _ a d j   t o   g e t   a n   e f f e c t i v e   o o m _ s c o r e   f o r   e a c h   c o n t a i n e r .   I t   t h e n   k i l l s   t h e   c o n t a i n e r   w i t h   t h e   h i g h e s t   s c o r e .   T h i s   m e a n s   t h a t   c o n t a i n e r s   i n   l o w   Q o S   p o d s   t h a t   c o n s u m e   a   l a r g e   a m o u n t   o f   m e m o r y   r e l a t i v e   t o   t h e i r   s c h e d u l i n g   r e q u e s t s   a r e   k i l l e d   f i r s t .   U n l i k e   p o d   e v i c t i o n ,   i f   a   c o n t a i n e r   i s   O O M   k i l l e d ,   t h e   k u b e l e t   c a n   r e s t a r t   i t   b a s e d   o n   i t s   r e s t a r t P o l i c y .


Question: What is Good practices?

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


Question: What is Schedulable resources and eviction policies?

Answer: W h e n   y o u   c o n f i g u r e   t h e   k u b e l e t   w i t h   a n   e v i c t i o n   p o l i c y ,   y o u   s h o u l d   m a k e   s u r e   t h a t   t h e   s c h e d u l e r   w i l l   n o t   s c h e d u l e   p o d s   i f   t h e y   w i l l   t r i g g e r   e v i c t i o n   b e c a u s e   t h e y   i m m e d i a t e l y   i n d u c e   m e m o r y   p r e s s u r e .   C o n s i d e r   t h e   f o l l o w i n g   s c e n a r i o :   N o d e   m e m o r y   c a p a c i t y :   1 0 G i B O p e r a t o r   w a n t s   t o   r e s e r v e   1 0 %   o f   m e m o r y   c a p a c i t y   f o r   s y s t e m   d a e m o n s   ( k e r n e l ,   k u b e l e t ,   e t c . ) O p e r a t o r   w a n t s   t o   e v i c t   P o d s   a t   9 5 %   m e m o r y   u t i l i z a t i o n   t o   r e d u c e   i n c i d e n c e   o f   s y s t e m   O O M .   F o r   t h i s   t o   w o r k ,   t h e   k u b e l e t   i s   l a u n c h e d   a s   f o l l o w s :   - - e v i c t i o n - h a r d = m e m o r y . a v a i l a b l e < 5 0 0 M i   - - s y s t e m - r e s e r v e d = m e m o r y = 1 . 5 G i   I n   t h i s   c o n f i g u r a t i o n ,   t h e   - - s y s t e m - r e s e r v e d   f l a g   r e s e r v e s   1 . 5 G i B   o f   m e m o r y   f o r   t h e   s y s t e m ,   w h i c h   i s   1 0 %   o f   t h e   t o t a l   m e m o r y   +   t h e   e v i c t i o n   t h r e s h o l d   a m o u n t .   T h e   n o d e   c a n   r e a c h   t h e   e v i c t i o n   t h r e s h o l d   i f   a   p o d   i s   u s i n g   m o r e   t h a n   i t s   r e q u e s t ,   o r   i f   t h e   s y s t e m   i s   u s i n g   m o r e   t h a n   1 G i B   o f   m e m o r y ,   w h i c h   m a k e s   t h e   m e m o r y . a v a i l a b l e   s i g n a l   f a l l   b e l o w   5 0 0 M i B   a n d   t r i g g e r s   t h e   t h r e s h o l d .


Question: What is DaemonSets and node-pressure eviction?

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


Question: What is Known issues?

Answer: T h e   f o l l o w i n g   s e c t i o n s   d e s c r i b e   k n o w n   i s s u e s   r e l a t e d   t o   o u t   o f   r e s o u r c e   h a n d l i n g .


Question: What is kubelet may not observe memory pressure right away?

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


Question: What is active_file memory is not considered as available memory?

Answer: O n   L i n u x ,   t h e   k e r n e l   t r a c k s   t h e   n u m b e r   o f   b y t e s   o f   f i l e - b a c k e d   m e m o r y   o n   a c t i v e   l e a s t   r e c e n t l y   u s e d   ( L R U )   l i s t   a s   t h e   a c t i v e _ f i l e   s t a t i s t i c .   T h e   k u b e l e t   t r e a t s   a c t i v e _ f i l e   m e m o r y   a r e a s   a s   n o t   r e c l a i m a b l e .   F o r   w o r k l o a d s   t h a t   m a k e   i n t e n s i v e   u s e   o f   b l o c k - b a c k e d   l o c a l   s t o r a g e ,   i n c l u d i n g   e p h e m e r a l   l o c a l   s t o r a g e ,   k e r n e l - l e v e l   c a c h e s   o f   f i l e   a n d   b l o c k   d a t a   m e a n s   t h a t   m a n y   r e c e n t l y   a c c e s s e d   c a c h e   p a g e s   a r e   l i k e l y   t o   b e   c o u n t e d   a s   a c t i v e _ f i l e .   I f   e n o u g h   o f   t h e s e   k e r n e l   b l o c k   b u f f e r s   a r e   o n   t h e   a c t i v e   L R U   l i s t ,   t h e   k u b e l e t   i s   l i a b l e   t o   o b s e r v e   t h i s   a s   h i g h   r e s o u r c e   u s e   a n d   t a i n t   t h e   n o d e   a s   e x p e r i e n c i n g   m e m o r y   p r e s s u r e   -   t r i g g e r i n g   p o d   e v i c t i o n .   F o r   m o r e   d e t a i l s ,   s e e   h t t p s : / / g i t h u b . c o m / k u b e r n e t e s / k u b e r n e t e s / i s s u e s / 4 3 9 1 6   Y o u   c a n   w o r k   a r o u n d   t h a t   b e h a v i o r   b y   s e t t i n g   t h e   m e m o r y   l i m i t   a n d   m e m o r y   r e q u e s t   t h e   s a m e   f o r   c o n t a i n e r s   l i k e l y   t o   p e r f o r m   i n t e n s i v e   I / O   a c t i v i t y .   Y o u   w i l l   n e e d   t o   e s t i m a t e   o r   m e a s u r e   a n   o p t i m a l   m e m o r y   l i m i t   v a l u e   f o r   t h a t   c o n t a i n e r .


Question: What is What's next?

Answer: L e a r n   a b o u t   A P I - i n i t i a t e d   E v i c t i o n L e a r n   a b o u t   P o d   P r i o r i t y   a n d   P r e e m p t i o n L e a r n   a b o u t   P o d D i s r u p t i o n B u d g e t s L e a r n   a b o u t   Q u a l i t y   o f   S e r v i c e   ( Q o S ) C h e c k   o u t   t h e   E v i c t i o n   A P I


Question: What is kubectl logs?

Answer: kubectl logsSynopsisPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] Examples # Return snapshot logs from pod nginx with only one container kubectl logs nginx # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name kubectl logs nginx --prefix # Return snapshot logs from pod nginx, limiting output to 500 bytes kubectl logs nginx --limit-bytes=500 # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running. kubectl logs nginx --pod-running-timeout=20s # Return snapshot logs from pod nginx with multi containers kubectl logs nginx --all-containers=true # Return snapshot logs from all pods in the deployment nginx kubectl logs deployment/nginx --all-pods=true # Return snapshot logs from all containers in pods defined by label app=nginx kubectl logs -l app=nginx --all-containers=true # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods kubectl logs -l app=nginx --max-log-requests=10 # Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 # Begin streaming the logs from pod nginx, continuing even if errors occur kubectl logs nginx -f --ignore-errors=true # Begin streaming the logs of the ruby container in pod web-1 kubectl logs -f -c ruby web-1 # Begin streaming the logs from all containers in pods defined by label app=nginx kubectl logs -f -l app=nginx --all-containers=true # Display only the most recent 20 lines of output in pod nginx kubectl logs --tail=20 nginx # Show all logs from pod nginx written in the last hour kubectl logs --since=1h nginx # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true # Show logs from a kubelet with an expired serving certificate kubectl logs --insecure-skip-tls-verify-backend nginx # Return snapshot logs from first container of a job named hello kubectl logs job/hello # Return snapshot logs from container nginx-1 of a deployment named nginx kubectl logs deployment/nginx -c nginx-1 Options--all-containersGet all containers' logs in the pod(s).--all-podsGet logs from all pod(s). Sets prefix to true.-c, --container stringPrint the logs of this container-f, --followSpecify if the logs should be streamed.-h, --helphelp for logs--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.--limit-bytes intMaximum bytes of logs to return. Defaults to no limit.--max-log-requests int Default: 5Specify maximum number of concurrent logs to


Question: How does kubectl logs work?

Answer: kubectl logsSynopsisPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] Examples # Return snapshot logs from pod nginx with only one container kubectl logs nginx # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name kubectl logs nginx --prefix # Return snapshot logs from pod nginx, limiting output to 500 bytes kubectl logs nginx --limit-bytes=500 # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running. kubectl logs nginx --pod-running-timeout=20s # Return snapshot logs from pod nginx with multi containers kubectl logs nginx --all-containers=true # Return snapshot logs from all pods in the deployment nginx kubectl logs deployment/nginx --all-pods=true # Return snapshot logs from all containers in pods defined by label app=nginx kubectl logs -l app=nginx --all-containers=true # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods kubectl logs -l app=nginx --max-log-requests=10 # Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 # Begin streaming the logs from pod nginx, continuing even if errors occur kubectl logs nginx -f --ignore-errors=true # Begin streaming the logs of the ruby container in pod web-1 kubectl logs -f -c ruby web-1 # Begin streaming the logs from all containers in pods defined by label app=nginx kubectl logs -f -l app=nginx --all-containers=true # Display only the most recent 20 lines of output in pod nginx kubectl logs --tail=20 nginx # Show all logs from pod nginx written in the last hour kubectl logs --since=1h nginx # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true # Show logs from a kubelet with an expired serving certificate kubectl logs --insecure-skip-tls-verify-backend nginx # Return snapshot logs from first container of a job named hello kubectl logs job/hello # Return snapshot logs from container nginx-1 of a deployment named nginx kubectl logs deployment/nginx -c nginx-1 Options--all-containersGet all containers' logs in the pod(s).--all-podsGet logs from all pod(s). Sets prefix to true.-c, --container stringPrint the logs of this container-f, --followSpecify if the logs should be streamed.-h, --helphelp for logs--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.--limit-bytes intMaximum bytes of logs to return. Defaults to no limit.--max-log-requests int Default: 5Specify maximum number of concurrent logs to


Question: When would you use kubectl logs?

Answer: kubectl logsSynopsisPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] Examples # Return snapshot logs from pod nginx with only one container kubectl logs nginx # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name kubectl logs nginx --prefix # Return snapshot logs from pod nginx, limiting output to 500 bytes kubectl logs nginx --limit-bytes=500 # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running. kubectl logs nginx --pod-running-timeout=20s # Return snapshot logs from pod nginx with multi containers kubectl logs nginx --all-containers=true # Return snapshot logs from all pods in the deployment nginx kubectl logs deployment/nginx --all-pods=true # Return snapshot logs from all containers in pods defined by label app=nginx kubectl logs -l app=nginx --all-containers=true # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods kubectl logs -l app=nginx --max-log-requests=10 # Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 # Begin streaming the logs from pod nginx, continuing even if errors occur kubectl logs nginx -f --ignore-errors=true # Begin streaming the logs of the ruby container in pod web-1 kubectl logs -f -c ruby web-1 # Begin streaming the logs from all containers in pods defined by label app=nginx kubectl logs -f -l app=nginx --all-containers=true # Display only the most recent 20 lines of output in pod nginx kubectl logs --tail=20 nginx # Show all logs from pod nginx written in the last hour kubectl logs --since=1h nginx # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true # Show logs from a kubelet with an expired serving certificate kubectl logs --insecure-skip-tls-verify-backend nginx # Return snapshot logs from first container of a job named hello kubectl logs job/hello # Return snapshot logs from container nginx-1 of a deployment named nginx kubectl logs deployment/nginx -c nginx-1 Options--all-containersGet all containers' logs in the pod(s).--all-podsGet logs from all pod(s). Sets prefix to true.-c, --container stringPrint the logs of this container-f, --followSpecify if the logs should be streamed.-h, --helphelp for logs--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.--limit-bytes intMaximum bytes of logs to return. Defaults to no limit.--max-log-requests int Default: 5Specify maximum number of concurrent logs to


Question: What are the benefits of kubectl logs?

Answer: kubectl logsSynopsisPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] Examples # Return snapshot logs from pod nginx with only one container kubectl logs nginx # Return snapshot logs from pod nginx, prefixing each line with the source pod and container name kubectl logs nginx --prefix # Return snapshot logs from pod nginx, limiting output to 500 bytes kubectl logs nginx --limit-bytes=500 # Return snapshot logs from pod nginx, waiting up to 20 seconds for it to start running. kubectl logs nginx --pod-running-timeout=20s # Return snapshot logs from pod nginx with multi containers kubectl logs nginx --all-containers=true # Return snapshot logs from all pods in the deployment nginx kubectl logs deployment/nginx --all-pods=true # Return snapshot logs from all containers in pods defined by label app=nginx kubectl logs -l app=nginx --all-containers=true # Return snapshot logs from all pods defined by label app=nginx, limiting concurrent log requests to 10 pods kubectl logs -l app=nginx --max-log-requests=10 # Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 # Begin streaming the logs from pod nginx, continuing even if errors occur kubectl logs nginx -f --ignore-errors=true # Begin streaming the logs of the ruby container in pod web-1 kubectl logs -f -c ruby web-1 # Begin streaming the logs from all containers in pods defined by label app=nginx kubectl logs -f -l app=nginx --all-containers=true # Display only the most recent 20 lines of output in pod nginx kubectl logs --tail=20 nginx # Show all logs from pod nginx written in the last hour kubectl logs --since=1h nginx # Show all logs with timestamps from pod nginx starting from August 30, 2024, at 06:00:00 UTC kubectl logs nginx --since-time=2024-08-30T06:00:00Z --timestamps=true # Show logs from a kubelet with an expired serving certificate kubectl logs --insecure-skip-tls-verify-backend nginx # Return snapshot logs from first container of a job named hello kubectl logs job/hello # Return snapshot logs from container nginx-1 of a deployment named nginx kubectl logs deployment/nginx -c nginx-1 Options--all-containersGet all containers' logs in the pod(s).--all-podsGet logs from all pod(s). Sets prefix to true.-c, --container stringPrint the logs of this container-f, --followSpecify if the logs should be streamed.-h, --helphelp for logs--ignore-errorsIf watching / following pod logs, allow for any errors that occur to be non-fatal--insecure-skip-tls-verify-backendSkip verifying the identity of the kubelet that logs are requested from. In theory, an attacker could provide invalid log content back. You might want to use this if your kubelet serving certificates have expired.--limit-bytes intMaximum bytes of logs to return. Defaults to no limit.--max-log-requests int Default: 5Specify maximum number of concurrent logs to


Question: What is Synopsis?

Answer: P r i n t   t h e   l o g s   f o r   a   c o n t a i n e r   i n   a   p o d   o r   s p e c i f i e d   r e s o u r c e .   I f   t h e   p o d   h a s   o n l y   o n e   c o n t a i n e r ,   t h e   c o n t a i n e r   n a m e   i s   o p t i o n a l .   k u b e c t l   l o g s   [ - f ]   [ - p ]   ( P O D   |   T Y P E / N A M E )   [ - c   C O N T A I N E R ]


Question: What is Examples?

Answer: #   R e t u r n   s n a p s h o t   l o g s   f r o m   p o d   n g i n x   w i t h   o n l y   o n e   c o n t a i n e r   k u b e c t l   l o g s   n g i n x   #   R e t u r n   s n a p s h o t   l o g s   f r o m   p o d   n g i n x ,   p r e f i x i n g   e a c h   l i n e   w i t h   t h e   s o u r c e   p o d   a n d   c o n t a i n e r   n a m e   k u b e c t l   l o g s   n g i n x   - - p r e f i x   #   R e t u r n   s n a p s h o t   l o g s   f r o m   p o d   n g i n x ,   l i m i t i n g   o u t p u t   t o   5 0 0   b y t e s   k u b e c t l   l o g s   n g i n x   - - l i m i t - b y t e s = 5 0 0   #   R e t u r n   s n a p s h o t   l o g s   f r o m   p o d   n g i n x ,   w a i t i n g   u p   t o   2 0   s e c o n d s   f o r   i t   t o   s t a r t   r u n n i n g .   k u b e c t l   l o g s   n g i n x   - - p o d - r u n n i n g - t i m e o u t = 2 0 s   #   R e t u r n   s n a p s h o t   l o g s   f r o m   p o d   n g i n x   w i t h   m u l t i   c o n t a i n e r s   k u b e c t l   l o g s   n g i n x   - - a l l - c o n t a i n e r s = t r u e   #   R e t u r n   s n a p s h o t   l o g s   f r o m   a l l   p o d s   i n   t h e   d e p l o y m e n t   n g i n x   k u b e c t l   l o g s   d e p l o y m e n t / n g i n x   - - a l l - p o d s = t r u e   #   R e t u r n   s n a p s h o t   l o g s   f r o m   a l l   c o n t a i n e r s   i n   p o d s   d e f i n e d   b y   l a b e l   a p p = n g i n x   k u b e c t l   l o g s   - l   a p p = n g i n x   - - a l l - c o n t a i n e r s = t r u e   #   R e t u r n   s n a p s h o t   l o g s   f r o m   a l l   p o d s   d e f i n e d   b y   l a b e l   a p p = n g i n x ,   l i m i t i n g   c o n c u r r e n t   l o g   r e q u e s t s   t o   1 0   p o d s   k u b e c t l   l o g s   - l   a p p = n g i n x   - - m a x - l o g - r e q u e s t s = 1 0   #   R e t u r n   s n a p s h o t   o f   p r e v i o u s   t e r m i n a t e d   r u b y   c o n t a i n e r   l o g s   f r


Question: What is Options?

Answer: G e t   a l l   c o n t a i n e r s '   l o g s   i n   t h e   p o d ( s ) .   G e t   l o g s   f r o m   a l l   p o d ( s ) .   S e t s   p r e f i x   t o   t r u e .   P r i n t   t h e   l o g s   o f   t h i s   c o n t a i n e r   S p e c i f y   i f   t h e   l o g s   s h o u l d   b e   s t r e a m e d .   h e l p   f o r   l o g s   I f   w a t c h i n g   /   f o l l o w i n g   p o d   l o g s ,   a l l o w   f o r   a n y   e r r o r s   t h a t   o c c u r   t o   b e   n o n - f a t a l   S k i p   v e r i f y i n g   t h e   i d e n t i t y   o f   t h e   k u b e l e t   t h a t   l o g s   a r e   r e q u e s t e d   f r o m .   I n   t h e o r y ,   a n   a t t a c k e r   c o u l d   p r o v i d e   i n v a l i d   l o g   c o n t e n t   b a c k .   Y o u   m i g h t   w a n t   t o   u s e   t h i s   i f   y o u r   k u b e l e t   s e r v i n g   c e r t i f i c a t e s   h a v e   e x p i r e d .   M a x i m u m   b y t e s   o f   l o g s   t o   r e t u r n .   D e f a u l t s   t o   n o   l i m i t .   S p e c i f y   m a x i m u m   n u m b e r   o f   c o n c u r r e n t   l o g s   t o   f o l l o w   w h e n   u s i n g   b y   a   s e l e c t o r .   D e f a u l t s   t o   5 .   T h e   l e n g t h   o f   t i m e   ( l i k e   5 s ,   2 m ,   o r   3 h ,   h i g h e r   t h a n   z e r o )   t o   w a i t   u n t i l   a t   l e a s t   o n e   p o d   i s   r u n n i n g   P r e f i x   e a c h   l o g   l i n e   w i t h   t h e   l o g   s o u r c e   ( p o d   n a m e   a n d   c o n t a i n e r   n a m e )   I f   t r u e ,   p r i n t   t h e   l o g s   f o r   t h e   p r e v i o u s   i n s t a n c e   o f   t h e   c o n t a i n e r   i n   a   p o d   i f   i t   e x i s t s .   S e l e c t o r   ( l a b e l   q u e r y )   t o   f i l t e r   o n ,   s u p p o r t s   ' = ' ,   ' = = ' ,   ' ! = ' ,   ' i n ' ,   ' n o t i n ' . ( e . g .   - l   k e y 1 = v a l u e 1 , k e y 2 = v a l u e 2 , k e y 3   i n   ( v a


Question: What is Parent Options Inherited?

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


Question: What is See Also?

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


Question: What is StatefulSet Basics?

Answer: StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates:


Question: How does StatefulSet Basics work?

Answer: StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates:


Question: When would you use StatefulSet Basics?

Answer: StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates:


Question: What are the benefits of StatefulSet Basics?

Answer: StatefulSet BasicsThis tutorial provides an introduction to managing applications with StatefulSets. It demonstrates how to create, delete, scale, and update the Pods of StatefulSets.Before you beginBefore you begin this tutorial, you should familiarize yourself with the following Kubernetes concepts:PodsCluster DNSHeadless ServicesPersistentVolumesPersistentVolume ProvisioningThe kubectl command line toolYou need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:iximiuz LabsKillercodaKodeKloudPlay with KubernetesYou should configure kubectl to use a context that uses the default namespace. If you are using an existing cluster, make sure that it's OK to use that cluster's default namespace to practice. Ideally, practice in a cluster that doesn't run any real workloads.It's also useful to read the concept page about StatefulSets.Note:This tutorial assumes that your cluster is configured to dynamically provision PersistentVolumes. You'll also need to have a default StorageClass. If your cluster is not configured to provision storage dynamically, you will have to manually provision two 1 GiB volumes prior to starting this tutorial and set up your cluster so that those PersistentVolumes map to the PersistentVolumeClaim templates that the StatefulSet defines.ObjectivesStatefulSets are intended to be used with stateful applications and distributed systems. However, the administration of stateful applications and distributed systems on Kubernetes is a broad, complex topic. In order to demonstrate the basic features of a StatefulSet, and not to conflate the former topic with the latter, you will deploy a simple web application using a StatefulSet.After this tutorial, you will be familiar with the following.How to create a StatefulSetHow a StatefulSet manages its PodsHow to delete a StatefulSetHow to scale a StatefulSetHow to update a StatefulSet's PodsCreating a StatefulSetBegin by creating a StatefulSet (and the Service that it relies upon) using the example below. It is similar to the example presented in the StatefulSets concept. It creates a headless Service, nginx, to publish the IP addresses of Pods in the StatefulSet, web.application/web/web.yaml apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: registry.k8s.io/nginx-slim:0.21 ports: - containerPort: 80 name: web volumeMounts: - name: www mountPath: /usr/share/nginx/html volumeClaimTemplates:


Question: What is StatefulSet Basics?

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


Question: What is Before you begin?

Answer: B e f o r e   y o u   b e g i n   t h i s   t u t o r i a l ,   y o u   s h o u l d   f a m i l i a r i z e   y o u r s e l f   w i t h   t h e   f o l l o w i n g   K u b e r n e t e s   c o n c e p t s :   P o d s C l u s t e r   D N S H e a d l e s s   S e r v i c e s P e r s i s t e n t V o l u m e s P e r s i s t e n t V o l u m e   P r o v i s i o n i n g 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   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   s h o u l d   c o n f i g u r e   k u b e c t l   t o   u s e   a   c o n t e x t   t h a t   u s e s   t h e   d e f a u l t   n a m e s p a c e .   I f   y o u   a r e   u s i n g   a n   e x i s t i n g   c l u s t e r ,   m a k e   s u r e   t h a t   i t ' s   O K   t o   u s e   t h a t   c l u s t e r ' s   d e f a u l t   n a m e s p a c e   t o   p r a c t i c e .   I d e a l l y ,   p r a c t i c e   i n   a   c l u s t e r   t h a t   d o e s n ' t   r u n   a n y   r e a l   w o r k l o a d s .   I t ' s   a l s o   u s e f u l   t o   r e a d   t h e   c o n c e p t   p a g e   a b o u t   S t a t e f u l S e t s .


Question: What is Objectives?

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


Question: What is Creating a StatefulSet?

Answer: B e g i n   b y   c r e a t i n g   a   S t a t e f u l S e t   ( a n d   t h e   S e r v i c e   t h a t   i t   r e l i e s   u p o n )   u s i n g   t h e   e x a m p l e   b e l o w .   I t   i s   s i m i l a r   t o   t h e   e x a m p l e   p r e s e n t e d   i n   t h e   S t a t e f u l S e t s   c o n c e p t .   I t   c r e a t e s   a   h e a d l e s s   S e r v i c e ,   n g i n x ,   t o   p u b l i s h   t h e   I P   a d d r e s s e s   o f   P o d s   i n   t h e   S t a t e f u l S e t ,   w e b .   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 :   n g i n x   l a b e l s :   a p p :   n g i n x   s p e c :   p o r t s :   -   p o r t :   8 0   n a m e :   w e b   c l u s t e r I P :   N o n e   s e l e c t o r :   a p p :   n g i n x   - - -   a p i V e r s i o n :   a p p s / v 1   k i n d :   S t a t e f u l S e t   m e t a d a t a :   n a m e :   w e b   s p e c :   s e r v i c e N a m e :   " n g i n x "   r e p l i c a s :   2   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   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 :   r e g i s t r y . k 8 s . i o / n g i n x - s l i m : 0 . 2 1   p o r t s :   -   c o n t a i n e r P o r t :   8 0   n a m e :   w e b   v o l u m e M o u n t s :   -   n a m e :   w w w   m o u n t P a t h :   / u s r / s h a r e / n g i n x / h t m l   v o l u m e C l a i m T e m p l a t e s :   -   m e t a d a t a :   n a m e :   w w w   s p e c :   a c c e s s M o d e s :   [   " R e a d W r i t e O n c e "   ]   r e s o u r c e s :   r e q u e s t s :   s t o r a g e :   1 G i   Y o u   w i l l   n e e d   t o   u s e   a t   l e a s t   t w o   t e r m i n a l   w i n d o w s .   I n   t h e   f i r s t   t e r m i n a l ,   u s e   k u b e c t l   g e t   t o   w a t c h   t h e   c r e a t i o n   o f   t h e   S t a t e f u l S e t ' s   P o d s .


Question: What is Ordered Pod creation?

Answer: A   S t a t e f u l S e t   d e f a u l t s   t o   c r e a t i n g   i t s   P o d s   i n   a   s t r i c t   o r d e r .   F o r   a   S t a t e f u l S e t   w i t h   n   r e p l i c a s ,   w h e n   P o d s   a r e   b e i n g   d e p l o y e d ,   t h e y   a r e   c r e a t e d   s e q u e n t i a l l y ,   o r d e r e d   f r o m   { 0 . . n - 1 } .   E x a m i n e   t h e   o u t p u t   o f   t h e   k u b e c t l   g e t   c o m m a n d   i n   t h e   f i r s t   t e r m i n a l .   E v e n t u a l l y ,   t h e   o u t p u t   w i l l   l o o k   l i k e   t h e   e x a m p l e   b e l o w .   #   D o   n o t   s t a r t   a   n e w   w a t c h ;   #   t h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   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   w e b - 0   0 / 1   P e n d i n g   0   0 s   w e b - 0   0 / 1   P e n d i n g   0   0 s   w e b - 0   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   w e b - 0   1 / 1   R u n n i n g   0   1 9 s   w e b - 1   0 / 1   P e n d i n g   0   0 s   w e b - 1   0 / 1   P e n d i n g   0   0 s   w e b - 1   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   w e b - 1   1 / 1   R u n n i n g   0   1 8 s   N o t i c e   t h a t   t h e   w e b - 1   P o d   i s   n o t   l a u n c h e d   u n t i l   t h e   w e b - 0   P o d   i s   R u n n i n g   ( s e e   P o d   P h a s e )   a n d   R e a d y   ( s e e   t y p e   i n   P o d   C o n d i t i o n s ) .   L a t e r   i n   t h i s   t u t o r i a l   y o u   w i l l   p r a c t i c e   p a r a l l e l   s t a r t u p .


Question: What is Pods in a StatefulSet?

Answer: P o d s   i n   a   S t a t e f u l S e t   h a v e   a   u n i q u e   o r d i n a l   i n d e x   a n d   a   s t a b l e   n e t w o r k   i d e n t i t y .


Question: What is Examining the Pod's ordinal index?

Answer: G e t   t h e   S t a t e f u l S e t ' s   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   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   w e b - 0   1 / 1   R u n n i n g   0   1 m   w e b - 1   1 / 1   R u n n i n g   0   1 m   A s   m e n t i o n e d   i n   t h e   S t a t e f u l S e t s   c o n c e p t ,   t h e   P o d s   i n   a   S t a t e f u l S e t   h a v e   a   s t i c k y ,   u n i q u e   i d e n t i t y .   T h i s   i d e n t i t y   i s   b a s e d   o n   a   u n i q u e   o r d i n a l   i n d e x   t h a t   i s   a s s i g n e d   t o   e a c h   P o d   b y   t h e   S t a t e f u l S e t   c o n t r o l l e r . T h e   P o d s '   n a m e s   t a k e   t h e   f o r m   < s t a t e f u l s e t   n a m e > - < o r d i n a l   i n d e x > .   S i n c e   t h e   w e b   S t a t e f u l S e t   h a s   t w o   r e p l i c a s ,   i t   c r e a t e s   t w o   P o d s ,   w e b - 0   a n d   w e b - 1 .


Question: What is Using stable network identities?

Answer: E a c h   P o d   h a s   a   s t a b l e   h o s t n a m e   b a s e d   o n   i t s   o r d i n a l   i n d e x .   U s e   k u b e c t l   e x e c   t o   e x e c u t e   t h e   h o s t n a m e   c o m m a n d   i n   e a c h   P o d :   f o r   i   i n   0   1 ;   d o   k u b e c t l   e x e c   " w e b - $ i "   - -   s h   - c   ' h o s t n a m e ' ;   d o n e   w e b - 0   w e b - 1   U s e   k u b e c t l   r u n   t o   e x e c u t e   a   c o n t a i n e r   t h a t   p r o v i d e s   t h e   n s l o o k u p   c o m m a n d   f r o m   t h e   d n s u t i l s   p a c k a g e .   U s i n g   n s l o o k u p   o n   t h e   P o d s '   h o s t n a m e s ,   y o u   c a n   e x a m i n e   t h e i r   i n - c l u s t e r   D N S   a d d r e s s e s :   k u b e c t l   r u n   - i   - - t t y   - - i m a g e   b u s y b o x : 1 . 2 8   d n s - t e s t   - - r e s t a r t = N e v e r   - - r m   w h i c h   s t a r t s   a   n e w   s h e l l .   I n   t h a t   n e w   s h e l l ,   r u n :   #   R u n   t h i s   i n   t h e   d n s - t e s t   c o n t a i n e r   s h e l l   n s l o o k u p   w e b - 0 . 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 :   S e r v e r :   1 0 . 0 . 0 . 1 0   A d d r e s s   1 :   1 0 . 0 . 0 . 1 0   k u b e - d n s . k u b e - s y s t e m . s v c . c l u s t e r . l o c a l   N a m e :   w e b - 0 . n g i n x   A d d r e s s   1 :   1 0 . 2 4 4 . 1 . 6   n s l o o k u p   w e b - 1 . n g i n x   S e r v e r :   1 0 . 0 . 0 . 1 0   A d d r e s s   1 :   1 0 . 0 . 0 . 1 0   k u b e - d n s . k u b e - s y s t e m . s v c . c l u s t e r . l o c a l   N a m e :   w e b - 1 . n g i n x   A d d r e s s   1 :   1 0 . 2 4 4 . 2 . 6   ( a n d   n o w   e x i t   t h e   c o n t a i n e r   s h e l l :   e x i t )   T h e   C N A M E   o f   t h e   h e a d l e s s   s e r v i c e   p o i n t s   t o   S R V   r e c o r d s   ( o n e   f o r   e a c h   P o d   t h a t   i s   R u n n i n g   a n d   R e a d y ) .   T h


Question: What is Discovery for specific Pods in a StatefulSet?

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


Question: What is Writing to stable storage?

Answer: G e t   t h e   P e r s i s t e n t V o l u m e C l a i m s   f o r   w e b - 0   a n d   w e b - 1 :   k u b e c t l   g e t   p v c   - 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 :   N A M E   S T A T U S   V O L U M E   C A P A C I T Y   A C C E S S M O D E S   A G E   w w w - w e b - 0   B o u n d   p v c - 1 5 c 2 6 8 c 7 - b 5 0 7 - 1 1 e 6 - 9 3 2 f - 4 2 0 1 0 a 8 0 0 0 0 2   1 G i   R W O   4 8 s   w w w - w e b - 1   B o u n d   p v c - 1 5 c 7 9 3 0 7 - b 5 0 7 - 1 1 e 6 - 9 3 2 f - 4 2 0 1 0 a 8 0 0 0 0 2   1 G i   R W O   4 8 s   T h e   S t a t e f u l S e t   c o n t r o l l e r   c r e a t e d   t w o   P e r s i s t e n t V o l u m e C l a i m s   t h a t   a r e   b o u n d   t o   t w o   P e r s i s t e n t V o l u m e s .   A s   t h e   c l u s t e r   u s e d   i n   t h i s   t u t o r i a l   i s   c o n f i g u r e d   t o   d y n a m i c a l l y   p r o v i s i o n   P e r s i s t e n t V o l u m e s ,   t h e   P e r s i s t e n t V o l u m e s   w e r e   c r e a t e d   a n d   b o u n d   a u t o m a t i c a l l y .   T h e   N G I N X   w e b s e r v e r ,   b y   d e f a u l t ,   s e r v e s   a n   i n d e x   f i l e   f r o m   / u s r / s h a r e / n g i n x / h t m l / i n d e x . h t m l .   T h e   v o l u m e M o u n t s   f i e l d   i n   t h e   S t a t e f u l S e t ' s   s p e c   e n s u r e s   t h a t   t h e   / u s r / s h a r e / n g i n x / h t m l   d i r e c t o r y   i s   b a c k e d   b y   a   P e r s i s t e n t V o l u m e .   W r i t e   t h e   P o d s '   h o s t n a m e s   t o   t h e i r   i n d e x . h t m l   f i l e s   a n d   v e r i f y   t h a t   t h e   N G I N X   w e b s e r v e r s   s e r v e   t h e   h o s t n a m e s :   f o r   i   i n   0   1 ;   d o   k u b e c t l   e x e c   " w e b - $ i "   - -   s h   - c   ' e c h o   " $ ( h o s t n a m e ) "   >   / u s r / s h a r e / n g i n x / h t m l / i n d e x . h t m l ' ;   d o n e   f o r   i   i n


Question: What is Note:?

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


Question: What is Scaling a StatefulSet?

Answer: S c a l i n g   a   S t a t e f u l S e t   r e f e r s   t o   i n c r e a s i n g   o r   d e c r e a s i n g   t h e   n u m b e r   o f   r e p l i c a s   ( h o r i z o n t a l   s c a l i n g ) .   T h i s   i s   a c c o m p l i s h e d   b y   u p d a t i n g   t h e   r e p l i c a s   f i e l d .   Y o u   c a n   u s e   e i t h e r   k u b e c t l   s c a l e   o r   k u b e c t l   p a t c h   t o   s c a l e   a   S t a t e f u l S e t .


Question: What is Scaling up?

Answer: S c a l i n g   u p   m e a n s   a d d i n g   m o r e   r e p l i c a s .   P r o v i d e d   t h a t   y o u r   a p p   i s   a b l e   t o   d i s t r i b u t e   w o r k   a c r o s s   t h e   S t a t e f u l S e t ,   t h e   n e w   l a r g e r   s e t   o f   P o d s   c a n   p e r f o r m   m o r e   o f   t h a t   w o r k .   I n   o n e   t e r m i n a l   w i n d o w ,   w a t c h   t h e   P o d s   i n   t h e   S t a t e f u l S e t :   #   I f   y o u   a l r e a d y   h a v e   a   w a t c h   r u n n i n g ,   y o u   c a n   c o n t i n u e   u s i n g   t h a t .   #   O t h e r w i s e ,   s t a r t   o n e .   #   E n d   t h i s   w a t c h   w h e n   t h e r e   a r e   5   h e a l t h y   P o d s   f o r   t h e   S t a t e f u l S e t   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   I n   a n o t h e r   t e r m i n a l   w i n d o w ,   u s e   k u b e c t l   s c a l e   t o   s c a l e   t h e   n u m b e r   o f   r e p l i c a s   t o   5 :   k u b e c t l   s c a l e   s t s   w e b   - - r e p l i c a s = 5   s t a t e f u l s e t . a p p s / w e b   s c a l e d   E x a m i n e   t h e   o u t p u t   o f   t h e   k u b e c t l   g e t   c o m m a n d   i n   t h e   f i r s t   t e r m i n a l ,   a n d   w a i t   f o r   t h e   t h r e e   a d d i t i o n a l   P o d s   t o   t r a n s i t i o n   t o   R u n n i n g   a n d   R e a d y .   #   T h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d   - - w a t c h   - l   a p p = n g i n x   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   w e b - 0   1 / 1   R u n n i n g   0   2 h   w e b - 1   1 / 1   R u n n i n g   0   2 h   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   w e b - 2   0 / 1   P e n d i n g   0   0 s   w e b - 2   0 / 1   P e n d i n g   0   0 s   w e b - 2   0 / 1   C o n t a i n e r C r e a t i n g   0   0 s   w e b - 2   1 / 1   R u n n i n g   0   1 9 s   w


Question: What is Scaling down?

Answer: S c a l i n g   d o w n   m e a n s   r e d u c i n g   t h e   n u m b e r   o f   r e p l i c a s .   F o r   e x a m p l e ,   y o u   m i g h t   d o   t h i s   b e c a u s e   t h e   l e v e l   o f   t r a f f i c   t o   a   s e r v i c e   h a s   d e c r e a s e d ,   a n d   a t   t h e   c u r r e n t   s c a l e   t h e r e   a r e   i d l e   r e s o u r c e s .   I n   o n e   t e r m i n a l ,   w a t c h   t h e   S t a t e f u l S e t ' s   P o d s :   #   E n d   t h i s   w a t c h   w h e n   t h e r e   a r e   o n l y   3   P o d s   f o r   t h e   S t a t e f u l S e t   k u b e c t l   g e t   p o d   - - w a t c h   - l   a p p = n g i n x   I n   a n o t h e r   t e r m i n a l ,   u s e   k u b e c t l   p a t c h   t o   s c a l e   t h e   S t a t e f u l S e t   b a c k   d o w n   t o   t h r e e   r e p l i c a s :   k u b e c t l   p a t c h   s t s   w e b   - p   ' { " s p e c " : { " r e p l i c a s " : 3 } } '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   W a i t   f o r   w e b - 4   a n d   w e b - 3   t o   t r a n s i t i o n   t o   T e r m i n a t i n g .   #   T h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   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   w e b - 0   1 / 1   R u n n i n g   0   3 h   w e b - 1   1 / 1   R u n n i n g   0   3 h   w e b - 2   1 / 1   R u n n i n g   0   5 5 s   w e b - 3   1 / 1   R u n n i n g   0   3 6 s   w e b - 4   0 / 1   C o n t a i n e r C r e a t i n g   0   1 8 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   w e b - 4   1 / 1   R u n n i n g   0   1 9 s   w e b - 4   1 / 1   T e r m i n a t i n g   0   2 4 s   w e b - 4   1 / 1   T e r m i n a t i n g   0   2 4 s   w e b - 3   1 / 1   T e r m i n a t i n g   0   4 2 s   w e b - 3   1 / 1   T e r m i n a t i n g   0   4 2 s


Question: What is Ordered Pod termination?

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


Question: What is Updating StatefulSets?

Answer: T h e   S t a t e f u l S e t   c o n t r o l l e r   s u p p o r t s   a u t o m a t e d   u p d a t e s .   T h e   s t r a t e g y   u s e d   i s   d e t e r m i n e d   b y   t h e   s p e c . u p d a t e S t r a t e g y   f i e l d   o f   t h e   S t a t e f u l S e t   A P I   o b j e c t .   T h i s   f e a t u r e   c a n   b e   u s e d   t o   u p g r a d e   t h e   c o n t a i n e r   i m a g e s ,   r e s o u r c e   r e q u e s t s   a n d / o r   l i m i t s ,   l a b e l s ,   a n d   a n n o t a t i o n s   o f   t h e   P o d s   i n   a   S t a t e f u l S e t .   T h e r e   a r e   t w o   v a l i d   u p d a t e   s t r a t e g i e s ,   R o l l i n g U p d a t e   ( t h e   d e f a u l t )   a n d   O n D e l e t e .


Question: What is RollingUpdate?

Answer: T h e   R o l l i n g U p d a t e   u p d a t e   s t r a t e g y   w i l l   u p d a t e   a l l   P o d s   i n   a   S t a t e f u l S e t ,   i n   r e v e r s e   o r d i n a l   o r d e r ,   w h i l e   r e s p e c t i n g   t h e   S t a t e f u l S e t   g u a r a n t e e s .   Y o u   c a n   s p l i t   u p d a t e s   t o   a   S t a t e f u l S e t   t h a t   u s e s   t h e   R o l l i n g U p d a t e   s t r a t e g y   i n t o   p a r t i t i o n s ,   b y   s p e c i f y i n g   . s p e c . u p d a t e S t r a t e g y . r o l l i n g U p d a t e . p a r t i t i o n .   Y o u ' l l   p r a c t i c e   t h a t   l a t e r   i n   t h i s   t u t o r i a l .   F i r s t ,   t r y   a   s i m p l e   r o l l i n g   u p d a t e .   I n   o n e   t e r m i n a l   w i n d o w ,   p a t c h   t h e   w e b   S t a t e f u l S e t   t o   c h a n g e   t h e   c o n t a i n e r   i m a g e   a g a i n :   k u b e c t l   p a t c h   s t a t e f u l s e t   w e b   - - t y p e = ' j s o n '   - p = ' [ { " o p " :   " r e p l a c e " ,   " p a t h " :   " / s p e c / t e m p l a t e / s p e c / c o n t a i n e r s / 0 / i m a g e " ,   " v a l u e " : " r e g i s t r y . k 8 s . i o / n g i n x - s l i m : 0 . 2 4 " } ] '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   I n   a n o t h e r   t e r m i n a l ,   w a t c h   t h e   P o d s   i n   t h e   S t a t e f u l S e t :   #   E n d   t h i s   w a t c h   w h e n   t h e   r o l l o u t   i s   c o m p l e t e   #   #   I f   y o u ' r e   n o t   s u r e ,   l e a v e   i t   r u n n i n g   o n e   m o r e   m i n u t e   k u b e c t l   g e t   p o d   - l   a p p = n g i n x   - - w a t c h   T h e   o u t p u t   i s   s i m i l a r   t o :   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   w e b - 0   1 / 1   R u n n i n g   0   7 m   w e b - 1   1 / 1   R u n n i n g   0   7 m   w e b - 2   1 / 1   R u n n i n g   0   8 m   w e b - 2   1 / 1   T e r m i n a t i n g


Question: What is Staging an update?

Answer: Y o u   c a n   s p l i t   u p d a t e s   t o   a   S t a t e f u l S e t   t h a t   u s e s   t h e   R o l l i n g U p d a t e   s t r a t e g y   i n t o   p a r t i t i o n s ,   b y   s p e c i f y i n g   . s p e c . u p d a t e S t r a t e g y . r o l l i n g U p d a t e . p a r t i t i o n .   F o r   m o r e   c o n t e x t ,   y o u   c a n   r e a d   P a r t i t i o n e d   r o l l i n g   u p d a t e s   i n   t h e   S t a t e f u l S e t   c o n c e p t   p a g e .   Y o u   c a n   s t a g e   a n   u p d a t e   t o   a   S t a t e f u l S e t   b y   u s i n g   t h e   p a r t i t i o n   f i e l d   w i t h i n   . s p e c . u p d a t e S t r a t e g y . r o l l i n g U p d a t e .   F o r   t h i s   u p d a t e ,   y o u   w i l l   k e e p   t h e   e x i s t i n g   P o d s   i n   t h e   S t a t e f u l S e t   u n c h a n g e d   w h i l s t   y o u   c h a n g e   t h e   p o d   t e m p l a t e   f o r   t h e   S t a t e f u l S e t .   T h e n   y o u   -   o r ,   o u t s i d e   o f   a   t u t o r i a l ,   s o m e   e x t e r n a l   a u t o m a t i o n   -   c a n   t r i g g e r   t h a t   p r e p a r e d   u p d a t e .   F i r s t ,   p a t c h   t h e   w e b   S t a t e f u l S e t   t o   a d d   a   p a r t i t i o n   t o   t h e   u p d a t e S t r a t e g y   f i e l d :   #   T h e   v a l u e   o f   " p a r t i t i o n "   d e t e r m i n e s   w h i c h   o r d i n a l s   a   c h a n g e   a p p l i e s   t o   #   M a k e   s u r e   t o   u s e   a   n u m b e r   b i g g e r   t h a n   t h e   l a s t   o r d i n a l   f o r   t h e   #   S t a t e f u l S e t   k u b e c t l   p a t c h   s t a t e f u l s e t   w e b   - p   ' { " s p e c " : { " u p d a t e S t r a t e g y " : { " t y p e " : " R o l l i n g U p d a t e " , " r o l l i n g U p d a t e " : { " p a r t i t i o n " : 3 } } } } '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   P a t c h   t h e   S t a t e f u l S e t   a g a i n


Question: What is Rolling out a canary?

Answer: Y o u ' r e   n o w   g o i n g   t o   t r y   a   c a n a r y   r o l l o u t   o f   t h a t   s t a g e d   c h a n g e .   Y o u   c a n   r o l l   o u t   a   c a n a r y   ( t o   t e s t   t h e   m o d i f i e d   t e m p l a t e )   b y   d e c r e m e n t i n g   t h e   p a r t i t i o n   y o u   s p e c i f i e d   a b o v e .   P a t c h   t h e   S t a t e f u l S e t   t o   d e c r e m e n t   t h e   p a r t i t i o n :   #   T h e   v a l u e   o f   " p a r t i t i o n "   s h o u l d   m a t c h   t h e   h i g h e s t   e x i s t i n g   o r d i n a l   f o r   #   t h e   S t a t e f u l S e t   k u b e c t l   p a t c h   s t a t e f u l s e t   w e b   - p   ' { " s p e c " : { " u p d a t e S t r a t e g y " : { " t y p e " : " R o l l i n g U p d a t e " , " r o l l i n g U p d a t e " : { " p a r t i t i o n " : 2 } } } } '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   T h e   c o n t r o l   p l a n e   t r i g g e r s   r e p l a c e m e n t   f o r   w e b - 2   ( i m p l e m e n t e d   b y   a   g r a c e f u l   d e l e t e   f o l l o w e d   b y   c r e a t i n g   a   n e w   P o d   o n c e   t h e   d e l e t i o n   i s   c o m p l e t e ) .   W a i t   f o r   t h e   n e w   w e b - 2   P o d   t o   b e   R u n n i n g   a n d   R e a d y .   #   T h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d   - l   a p p = n g i n x   - - w a t c h   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   w e b - 0   1 / 1   R u n n i n g   0   4 m   w e b - 1   1 / 1   R u n n i n g   0   4 m   w e b - 2   0 / 1   C o n t a i n e r C r e a t i n g   0   1 1 s   w e b - 2   1 / 1   R u n n i n g   0   1 8 s   G e t   t h e   P o d ' s   c o n t a i n e r :   k u b e c t l   g e t   p o d   w e b - 2   - - t e m p l a t e   ' { { r a n g e   $ i ,   $ c   : =   . s p e c . c o n t a i n e r s } } { { $ c . i m a g e } } { { e n d } } '   r e g i s t r y . k 8 s . i o / n g


Question: What is Phased roll outs?

Answer: Y o u   c a n   p e r f o r m   a   p h a s e d   r o l l   o u t   ( e . g .   a   l i n e a r ,   g e o m e t r i c ,   o r   e x p o n e n t i a l   r o l l   o u t )   u s i n g   a   p a r t i t i o n e d   r o l l i n g   u p d a t e   i n   a   s i m i l a r   m a n n e r   t o   h o w   y o u   r o l l e d   o u t   a   c a n a r y .   T o   p e r f o r m   a   p h a s e d   r o l l   o u t ,   s e t   t h e   p a r t i t i o n   t o   t h e   o r d i n a l   a t   w h i c h   y o u   w a n t   t h e   c o n t r o l l e r   t o   p a u s e   t h e   u p d a t e .   T h e   p a r t i t i o n   i s   c u r r e n t l y   s e t   t o   2 .   S e t   t h e   p a r t i t i o n   t o   0 :   k u b e c t l   p a t c h   s t a t e f u l s e t   w e b   - p   ' { " s p e c " : { " u p d a t e S t r a t e g y " : { " t y p e " : " R o l l i n g U p d a t e " , " r o l l i n g U p d a t e " : { " p a r t i t i o n " : 0 } } } } '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   W a i t   f o r   a l l   o f   t h e   P o d s   i n   t h e   S t a t e f u l S e t   t o   b e c o m e   R u n n i n g   a n d   R e a d y .   #   T h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d   - l   a p p = n g i n x   - - w a t c h   T h e   o u t p u t   i s   s i m i l a r   t o :   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   w e b - 0   1 / 1   R u n n i n g   0   3 m   w e b - 1   0 / 1   C o n t a i n e r C r e a t i n g   0   1 1 s   w e b - 2   1 / 1   R u n n i n g   0   2 m   w e b - 1   1 / 1   R u n n i n g   0   1 8 s   w e b - 0   1 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   1 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   3 m   w e b - 0   0 / 1   P e n d i n g   0   0 s   w e b - 0   0 / 1   P


Question: What is OnDelete?

Answer: Y o u   s e l e c t   t h i s   u p d a t e   s t r a t e g y   f o r   a   S t a t e f u l S e t   b y   s e t t i n g   t h e   . s p e c . t e m p l a t e . u p d a t e S t r a t e g y . t y p e   t o   O n D e l e t e .   P a t c h   t h e   w e b   S t a t e f u l S e t   t o   u s e   t h e   O n D e l e t e   u p d a t e   s t r a t e g y :   k u b e c t l   p a t c h   s t a t e f u l s e t   w e b   - p   ' { " s p e c " : { " u p d a t e S t r a t e g y " : { " t y p e " : " O n D e l e t e " ,   " r o l l i n g U p d a t e " :   n u l l } } } '   s t a t e f u l s e t . a p p s / w e b   p a t c h e d   W h e n   y o u   s e l e c t   t h i s   u p d a t e   s t r a t e g y ,   t h e   S t a t e f u l S e t   c o n t r o l l e r   d o e s   n o t   a u t o m a t i c a l l y   u p d a t e   P o d s   w h e n   a   m o d i f i c a t i o n   i s   m a d e   t o   t h e   S t a t e f u l S e t ' s   . s p e c . t e m p l a t e   f i e l d .   Y o u   n e e d   t o   m a n a g e   t h e   r o l l o u t   y o u r s e l f   -   e i t h e r   m a n u a l l y ,   o r   u s i n g   s e p a r a t e   a u t o m a t i o n .


Question: What is Deleting StatefulSets?

Answer: S t a t e f u l S e t   s u p p o r t s   b o t h   n o n - c a s c a d i n g   a n d   c a s c a d i n g   d e l e t i o n .   I n   a   n o n - c a s c a d i n g   d e l e t e ,   t h e   S t a t e f u l S e t ' s   P o d s   a r e   n o t   d e l e t e d   w h e n   t h e   S t a t e f u l S e t   i s   d e l e t e d .   I n   a   c a s c a d i n g   d e l e t e ,   b o t h   t h e   S t a t e f u l S e t   a n d   i t s   P o d s   a r e   d e l e t e d .   R e a d   U s e   C a s c a d i n g   D e l e t i o n   i n   a   C l u s t e r   t o   l e a r n   a b o u t   c a s c a d i n g   d e l e t i o n   g e n e r a l l y .


Question: What is Non-cascading delete?

Answer: I n   o n e   t e r m i n a l   w i n d o w ,   w a t c h   t h e   P o d s   i n   t h e   S t a t e f u l S e t .   #   E n d   t h i s   w a t c h   w h e n   t h e r e   a r e   n o   P o d s   f o r   t h e   S t a t e f u l S e t   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   U s e   k u b e c t l   d e l e t e   t o   d e l e t e   t h e   S t a t e f u l S e t .   M a k e   s u r e   t o   s u p p l y   t h e   - - c a s c a d e = o r p h a n   p a r a m e t e r   t o   t h e   c o m m a n d .   T h i s   p a r a m e t e r   t e l l s   K u b e r n e t e s   t o   o n l y   d e l e t e   t h e   S t a t e f u l S e t ,   a n d   t o   n o t   d e l e t e   a n y   o f   i t s   P o d s .   k u b e c t l   d e l e t e   s t a t e f u l s e t   w e b   - - c a s c a d e = o r p h a n   s t a t e f u l s e t . a p p s   " w e b "   d e l e t e d   G e t   t h e   P o d s ,   t o   e x a m i n e   t h e i r   s t a t u s :   k u b e c t l   g e t   p o d s   - l   a p p = n g i n x   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   w e b - 0   1 / 1   R u n n i n g   0   6 m   w e b - 1   1 / 1   R u n n i n g   0   7 m   w e b - 2   1 / 1   R u n n i n g   0   5 m   E v e n   t h o u g h   w e b   h a s   b e e n   d e l e t e d ,   a l l   o f   t h e   P o d s   a r e   s t i l l   R u n n i n g   a n d   R e a d y .   D e l e t e   w e b - 0 :   k u b e c t l   d e l e t e   p o d   w e b - 0   p o d   " w e b - 0 "   d e l e t e d   G e t   t h e   S t a t e f u l S e t ' s   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   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   w e b - 1   1 / 1   R u n n i n g   0   1 0 m   w e b - 2   1 / 1   R u n n i n g   0   7 m   A s   t h e   w e b   S t a t e f u l S e t   h a s   b e e n   d e l e t e d ,   w e b - 0   h a s   n o t   b e e n   r e l a u n c h e d .   I n   o n e   t e r m i n a l ,   w a t c h   t h e   S t a t e f u l S e


Question: What is Cascading delete?

Answer: I n   o n e   t e r m i n a l   w i n d o w ,   w a t c h   t h e   P o d s   i n   t h e   S t a t e f u l S e t .   #   L e a v e   t h i s   r u n n i n g   u n t i l   t h e   n e x t   p a g e   s e c t i o n   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   I n   a n o t h e r   t e r m i n a l ,   d e l e t e   t h e   S t a t e f u l S e t   a g a i n .   T h i s   t i m e ,   o m i t   t h e   - - c a s c a d e = o r p h a n   p a r a m e t e r .   k u b e c t l   d e l e t e   s t a t e f u l s e t   w e b   s t a t e f u l s e t . a p p s   " w e b "   d e l e t e d   E x a m i n e   t h e   o u t p u t   o f   t h e   k u b e c t l   g e t   c o m m a n d   r u n n i n g   i n   t h e   f i r s t   t e r m i n a l ,   a n d   w a i t   f o r   a l l   o f   t h e   P o d s   t o   t r a n s i t i o n   t o   T e r m i n a t i n g .   #   T h i s   s h o u l d   a l r e a d y   b e   r u n n i n g   k u b e c t l   g e t   p o d s   - - w a t c h   - l   a p p = n g i n x   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   w e b - 0   1 / 1   R u n n i n g   0   1 1 m   w e b - 1   1 / 1   R u n n i n g   0   2 7 m   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   w e b - 0   1 / 1   T e r m i n a t i n g   0   1 2 m   w e b - 1   1 / 1   T e r m i n a t i n g   0   2 9 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   1 2 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   1 2 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   1 2 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   2 9 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   2 9 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   2 9 m   A s   y o u   s a w   i n   t h e   S c a l i n g   D o w n   s e c t i o n ,   t h e   P o d s   a r e   t e r m i n a t e d   o n e   a t   a   t i m e ,   w i t h   r e s p e c t   t o   t h e   r e v e r s e   o r d e r   o f   t h e i r   o r d i n a l   i n d i c e s .   B e f o r e   t e r m i n


Question: What is Note:?

Answer: k u b e c t l   d e l e t e   s e r v i c e   n g i n x   s e r v i c e   " n g i n x "   d e l e t e d   R e c r e a t e   t h e   S t a t e f u l S e t   a n d   h e a d l e s s   S e r v i c e   o n e   m o r e   t i m 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 / w e b / w e b . y a m l   s e r v i c e / n g i n x   c r e a t e d   s t a t e f u l s e t . a p p s / w e b   c r e a t e d   W h e n   a l l   o f   t h e   S t a t e f u l S e t ' s   P o d s   t r a n s i t i o n   t o   R u n n i n g   a n d   R e a d y ,   r e t r i e v e   t h e   c o n t e n t s   o f   t h e i r   i n d e x . h t m l   f i l e s :   f o r   i   i n   0   1 ;   d o   k u b e c t l   e x e c   - i   - t   " w e b - $ i "   - -   c u r l   h t t p : / / l o c a l h o s t / ;   d o n e   w e b - 0   w e b - 1   E v e n   t h o u g h   y o u   c o m p l e t e l y   d e l e t e d   t h e   S t a t e f u l S e t ,   a n d   a l l   o f   i t s   P o d s ,   t h e   P o d s   a r e   r e c r e a t e d   w i t h   t h e i r   P e r s i s t e n t V o l u m e s   m o u n t e d ,   a n d   w e b - 0   a n d   w e b - 1   c o n t i n u e   t o   s e r v e   t h e i r   h o s t n a m e s .   F i n a l l y ,   d e l e t e   t h e   n g i n x   S e r v i c e . . .   k u b e c t l   d e l e t e   s e r v i c e   n g i n x   s e r v i c e   " n g i n x "   d e l e t e d   . . . a n d   t h e   w e b   S t a t e f u l S e t :   k u b e c t l   d e l e t e   s t a t e f u l s e t   w e b   s t a t e f u l s e t   " w e b "   d e l e t e d


Question: What is Pod management policy?

Answer: F o r   s o m e   d i s t r i b u t e d   s y s t e m s ,   t h e   S t a t e f u l S e t   o r d e r i n g   g u a r a n t e e s   a r e   u n n e c e s s a r y   a n d / o r   u n d e s i r a b l e .   T h e s e   s y s t e m s   r e q u i r e   o n l y   u n i q u e n e s s   a n d   i d e n t i t y .   Y o u   c a n   s p e c i f y   a   P o d   m a n a g e m e n t   p o l i c y   t o   a v o i d   t h i s   s t r i c t   o r d e r i n g ;   e i t h e r   O r d e r e d R e a d y   ( t h e   d e f a u l t ) ,   o r   P a r a l l e l .


Question: What is OrderedReady Pod management?

Answer: O r d e r e d R e a d y   p o d   m a n a g e m e n t   i s   t h e   d e f a u l t   f o r   S t a t e f u l S e t s .   I t   t e l l s   t h e   S t a t e f u l S e t   c o n t r o l l e r   t o   r e s p e c t   t h e   o r d e r i n g   g u a r a n t e e s   d e m o n s t r a t e d   a b o v e .   U s e   t h i s   w h e n   y o u r   a p p l i c a t i o n   r e q u i r e s   o r   e x p e c t s   t h a t   c h a n g e s ,   s u c h   a s   r o l l i n g   o u t   a   n e w   v e r s i o n   o f   y o u r   a p p l i c a t i o n ,   h a p p e n   i n   t h e   s t r i c t   o r d e r   o f   t h e   o r d i n a l   ( p o d   n u m b e r )   t h a t   t h e   S t a t e f u l S e t   p r o v i d e s .   I n   o t h e r   w o r d s ,   i f   y o u   h a v e   P o d s   a p p - 0 ,   a p p - 1   a n d   a p p - 2 ,   K u b e r n e t e s   w i l l   u p d a t e   a p p - 0   f i r s t   a n d   c h e c k   i t .   O n c e   t h e   c h e c k s   a r e   g o o d ,   K u b e r n e t e s   u p d a t e s   a p p - 1   a n d   f i n a l l y   a p p - 2 .   I f   y o u   a d d e d   t w o   m o r e   P o d s ,   K u b e r n e t e s   w o u l d   s e t   u p   a p p - 3   a n d   w a i t   f o r   t h a t   t o   b e c o m e   h e a l t h y   b e f o r e   d e p l o y i n g   a p p - 4 .   B e c a u s e   t h i s   i s   t h e   d e f a u l t   s e t t i n g ,   y o u ' v e   a l r e a d y   p r a c t i s e d   u s i n g   i t .


Question: What is Parallel Pod management?

Answer: T h e   a l t e r n a t i v e ,   P a r a l l e l   p o d   m a n a g e m e n t ,   t e l l s   t h e   S t a t e f u l S e t   c o n t r o l l e r   t o   l a u n c h   o r   t e r m i n a t e   a l l   P o d s   i n   p a r a l l e l ,   a n d   n o t   t o   w a i t   f o r   P o d s   t o   b e c o m e   R u n n i n g   a n d   R e a d y   o r   c o m p l e t e l y   t e r m i n a t e d   p r i o r   t o   l a u n c h i n g   o r   t e r m i n a t i n g   a n o t h e r   P o d .   T h e   P a r a l l e l   p o d   m a n a g e m e n t   o p t i o n   o n l y   a f f e c t s   t h e   b e h a v i o r   f o r   s c a l i n g   o p e r a t i o n s .   U p d a t e s   a r e   n o t   a f f e c t e d ;   K u b e r n e t e s   s t i l l   r o l l s   o u t   c h a n g e s   i n   o r d e r .   F o r   t h i s   t u t o r i a l ,   t h e   a p p l i c a t i o n   i s   v e r y   s i m p l e :   a   w e b s e r v e r   t h a t   t e l l s   y o u   i t s   h o s t n a m e   ( b e c a u s e   t h i s   i s   a   S t a t e f u l S e t ,   t h e   h o s t n a m e   f o r   e a c h   P o d   i s   d i f f e r e n t   a n d   p r e d i c t a b l e ) .   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 :   n g i n x   l a b e l s :   a p p :   n g i n x   s p e c :   p o r t s :   -   p o r t :   8 0   n a m e :   w e b   c l u s t e r I P :   N o n e   s e l e c t o r :   a p p :   n g i n x   - - -   a p i V e r s i o n :   a p p s / v 1   k i n d :   S t a t e f u l S e t   m e t a d a t a :   n a m e :   w e b   s p e c :   s e r v i c e N a m e :   " n g i n x "   p o d M a n a g e m e n t P o l i c y :   " P a r a l l e l "   r e p l i c a s :   2   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   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 :   r e g i s t r y . k 8 s . i o / n g i n x - s l i m : 0 . 2 4   p


Question: What is Cleaning up?

Answer: Y o u   s h o u l d   h a v e   t w o   t e r m i n a l s   o p e n ,   r e a d y   f o r   y o u   t o   r u n   k u b e c t l   c o m m a n d s   a s   p a r t   o f   c l e a n u p .   k u b e c t l   d e l e t e   s t s   w e b   #   s t s   i s   a n   a b b r e v i a t i o n   f o r   s t a t e f u l s e t   Y o u   c a n   w a t c h   k u b e c t l   g e t   t o   s e e   t h o s e   P o d s   b e i n g   d e l e t e d .   #   e n d   t h e   w a t c h   w h e n   y o u ' v e   s e e n   w h a t   y o u   n e e d   t o   k u b e c t l   g e t   p o d   - l   a p p = n g i n x   - - w a t c h   w e b - 3   1 / 1   T e r m i n a t i n g   0   9 m   w e b - 2   1 / 1   T e r m i n a t i n g   0   9 m   w e b - 3   1 / 1   T e r m i n a t i n g   0   9 m   w e b - 2   1 / 1   T e r m i n a t i n g   0   9 m   w e b - 1   1 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   1 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 3   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 2   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 2   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 2   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 2   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 1   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 0   0 / 1   T e r m i n a t i n g   0   4 4 m   w e b - 3   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 3   0 / 1   T e r m i n a t i n g   0   9 m   w e b - 3   0 / 1   T e r m i n a t i n g   0   9 m   D u r i n g   d e l e t i o n ,   a   S t a t e f u l S e t   r e m o v e s   a l l   P o d s   c o n c u r r e n t l y ;   i t


Question: What is Deployment?

Answer: DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1import "k8s.io/api/apps/v1"DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1kind: Deploymentmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (DeploymentSpec)Specification of the desired behavior of the Deployment.status (DeploymentStatus)Most recently observed status of the Deployment.DeploymentSpecDeploymentSpec is the specification of the desired behavior of the Deployment.selector (LabelSelector), requiredLabel selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.template (PodTemplateSpec), requiredTemplate describes the pods that will be created. The only allowed template.spec.restartPolicy value is "Always".replicas (int32)Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.minReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)strategy (DeploymentStrategy)Patch strategy: retainKeysThe deployment strategy to use to replace existing pods with new ones.DeploymentStrategy describes how to replace existing pods with new ones.strategy.type (string)Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.strategy.rollingUpdate (RollingUpdateDeployment)Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.Spec to control the desired behavior of rolling update.strategy.rollingUpdate.maxSurge (IntOrString)The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.strategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is cal


Question: How does Deployment work?

Answer: DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1import "k8s.io/api/apps/v1"DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1kind: Deploymentmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (DeploymentSpec)Specification of the desired behavior of the Deployment.status (DeploymentStatus)Most recently observed status of the Deployment.DeploymentSpecDeploymentSpec is the specification of the desired behavior of the Deployment.selector (LabelSelector), requiredLabel selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.template (PodTemplateSpec), requiredTemplate describes the pods that will be created. The only allowed template.spec.restartPolicy value is "Always".replicas (int32)Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.minReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)strategy (DeploymentStrategy)Patch strategy: retainKeysThe deployment strategy to use to replace existing pods with new ones.DeploymentStrategy describes how to replace existing pods with new ones.strategy.type (string)Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.strategy.rollingUpdate (RollingUpdateDeployment)Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.Spec to control the desired behavior of rolling update.strategy.rollingUpdate.maxSurge (IntOrString)The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.strategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is cal


Question: When would you use Deployment?

Answer: DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1import "k8s.io/api/apps/v1"DeploymentDeployment enables declarative updates for Pods and ReplicaSets.apiVersion: apps/v1kind: Deploymentmetadata (ObjectMeta)Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadataspec (DeploymentSpec)Specification of the desired behavior of the Deployment.status (DeploymentStatus)Most recently observed status of the Deployment.DeploymentSpecDeploymentSpec is the specification of the desired behavior of the Deployment.selector (LabelSelector), requiredLabel selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.template (PodTemplateSpec), requiredTemplate describes the pods that will be created. The only allowed template.spec.restartPolicy value is "Always".replicas (int32)Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.minReadySeconds (int32)Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)strategy (DeploymentStrategy)Patch strategy: retainKeysThe deployment strategy to use to replace existing pods with new ones.DeploymentStrategy describes how to replace existing pods with new ones.strategy.type (string)Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.strategy.rollingUpdate (RollingUpdateDeployment)Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.Spec to control the desired behavior of rolling update.strategy.rollingUpdate.maxSurge (IntOrString)The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.strategy.rollingUpdate.maxUnavailable (IntOrString)The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is cal