Question: What is Before you begin?

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


Question: What is Create a simple Pod to use as a test environment?

Answer: a p i V e r s i o n :   v 1   k i n d :   P o d   m e t a d a t a :   n a m e :   d n s u t i l s   n a m e s p a c e :   d e f a u l t   s p e c :   c o n t a i n e r s :   -   n a m e :   d n s u t i l s   i m a g e :   r e g i s t r y . k 8 s . i o / e 2 e - t e s t - i m a g e s / a g n h o s t : 2 . 3 9   i m a g e P u l l P o l i c y :   I f N o t P r e s e n t   r e s t a r t P o l i c y :   A l w a y s


Question: What is Note:?

Answer: U s e   t h a t   m a n i f e s t   t o   c r e a t e   a   P o d :   k u b e c t l   a p p l y   - f   h t t p s : / / k 8 s . i o / e x a m p l e s / a d m i n / d n s / d n s u t i l s . y a m l   p o d / d n s u t i l s   c r e a t e d   … a n d   v e r i f y   i t s   s t a t u s :   k u b e c t l   g e t   p o d s   d n s u t i l 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   d n s u t i l s   1 / 1   R u n n i n g   0   < s o m e - t i m e >   O n c e   t h a t   P o d   i s   r u n n i n g ,   y o u   c a n   e x e c   n s l o o k u p   i n   t h a t   e n v i r o n m e n t .   I f   y o u   s e e   s o m e t h i n g   l i k e   t h e   f o l l o w i n g ,   D N S   i s   w o r k i n g   c o r r e c t l y .   k u b e c t l   e x e c   - i   - t   d n s u t i l s   - -   n s l o o k u p   k u b e r n e t e s . d e f a u l t   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   N a m e :   k u b e r n e t e s . d e f a u l t   A d d r e s s   1 :   1 0 . 0 . 0 . 1   I f   t h e   n s l o o k u p   c o m m a n d   f a i l s ,   c h e c k   t h e   f o l l o w i n g :


Question: What is Check the local DNS configuration first?

Answer: T a k e   a   l o o k   i n s i d e   t h e   r e s o l v . c o n f   f i l e .   ( S e e   C u s t o m i z i n g   D N S   S e r v i c e   a n d   K n o w n   i s s u e s   b e l o w   f o r   m o r e   i n f o r m a t i o n )   k u b e c t l   e x e c   - t i   d n s u t i l s   - -   c a t   / e t c / r e s o l v . c o n f   V e r i f y   t h a t   t h e   s e a r c h   p a t h   a n d   n a m e   s e r v e r   a r e   s e t   u p   l i k e   t h e   f o l l o w i n g   ( n o t e   t h a t   s e a r c h   p a t h   m a y   v a r y   f o r   d i f f e r e n t   c l o u d   p r o v i d e r s ) :   s e a r c h   d e f a u l t . s v c . c l u s t e r . l o c a l   s v c . c l u s t e r . l o c a l   c l u s t e r . l o c a l   g o o g l e . i n t e r n a l   c . g c e _ p r o j e c t _ i d . i n t e r n a l   n a m e s e r v e r   1 0 . 0 . 0 . 1 0   o p t i o n s   n d o t s : 5   E r r o r s   s u c h   a s   t h e   f o l l o w i n g   i n d i c a t e   a   p r o b l e m   w i t h   t h e   C o r e D N S   ( o r   k u b e - d n s )   a d d - o n   o r   w i t h   a s s o c i a t e d   S e r v i c e s :   k u b e c t l   e x e c   - i   - t   d n s u t i l s   - -   n s l o o k u p   k u b e r n e t e s . d e f a u l t   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   n s l o o k u p :   c a n ' t   r e s o l v e   ' k u b e r n e t e s . d e f a u l t '   o r   k u b e c t l   e x e c   - i   - t   d n s u t i l s   - -   n s l o o k u p   k u b e r n e t e s . d e f a u l t   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 s l o o k u p :   c a n ' t   r e s o l v e   ' k u b e r n e t e s . d e f a u l t '


Question: What is Check if the DNS pod is running?

Answer: U s e   t h e   k u b e c t l   g e t   p o d s   c o m m a n d   t o   v e r i f y   t h a t   t h e   D N S   p o d   i s   r u n n i n g .   k u b e c t l   g e t   p o d s   - - n a m e s p a c e = k u b e - s y s t e m   - l   k 8 s - a p p = k u b e - d n 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   . . .   c o r e d n s - 7 b 9 6 b f 9 f 7 6 - 5 h s x b   1 / 1   R u n n i n g   0   1 h   c o r e d n s - 7 b 9 6 b f 9 f 7 6 - m v m m t   1 / 1   R u n n i n g   0   1 h   . . .


Question: What is Note:?

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


Question: What is Check for errors in the DNS pod?

Answer: U s e   t h e   k u b e c t l   l o g s   c o m m a n d   t o   s e e   l o g s   f o r   t h e   D N S   c o n t a i n e r s .   F o r   C o r e D N S :   k u b e c t l   l o g s   - - n a m e s p a c e = k u b e - s y s t e m   - l   k 8 s - a p p = k u b e - d n s   H e r e   i s   a n   e x a m p l e   o f   a   h e a l t h y   C o r e D N S   l o g :   . : 5 3   2 0 1 8 / 0 8 / 1 5   1 4 : 3 7 : 1 7   [ I N F O ]   C o r e D N S - 1 . 2 . 2   2 0 1 8 / 0 8 / 1 5   1 4 : 3 7 : 1 7   [ I N F O ]   l i n u x / a m d 6 4 ,   g o 1 . 1 0 . 3 ,   2 e 3 2 2 f 6   C o r e D N S - 1 . 2 . 2   l i n u x / a m d 6 4 ,   g o 1 . 1 0 . 3 ,   2 e 3 2 2 f 6   2 0 1 8 / 0 8 / 1 5   1 4 : 3 7 : 1 7   [ I N F O ]   p l u g i n / r e l o a d :   R u n n i n g   c o n f i g u r a t i o n   M D 5   =   2 4 e 6 c 5 9 e 8 3 c e 7 0 6 f 0 7 b c c 8 2 c 3 1 b 1 e a 1 c   S e e   i f   t h e r e   a r e   a n y   s u s p i c i o u s   o r   u n e x p e c t e d   m e s s a g e s   i n   t h e   l o g s .


Question: What is Is DNS service up??

Answer: V e r i f y   t h a t   t h e   D N S   s e r v i c e   i s   u p   b y   u s i n g   t h e   k u b e c t l   g e t   s e r v i c e   c o m m a n d .   k u b e c t l   g e t   s v c   - - n a m e s p a c e = k u b e - s y s t e m   N A M E   T Y P E   C L U S T E R - I P   E X T E R N A L - I P   P O R T ( S )   A G E   . . .   k u b e - d n s   C l u s t e r I P   1 0 . 0 . 0 . 1 0   < n o n e >   5 3 / U D P , 5 3 / T C P   1 h   . . .


Question: What is Note:?

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


Question: What is Are DNS endpoints exposed??

Answer: Y o u   c a n   v e r i f y   t h a t   D N S   e n d p o i n t s   a r e   e x p o s e d   b y   u s i n g   t h e   k u b e c t l   g e t   e n d p o i n t s l i c e   c o m m a n d .   k u b e c t l   g e t   e n d p o i n t s l i c e s   - l   k 8 s . i o / s e r v i c e - n a m e = k u b e - d n s   - - n a m e s p a c e = k u b e - s y s t e m   N A M E   A D D R E S S T Y P E   P O R T S   E N D P O I N T S   A G E   k u b e - d n s - z x o j a   I P v 4   5 3   1 0 . 1 8 0 . 3 . 1 7 , 1 0 . 1 8 0 . 3 . 1 7   1 h   I f   y o u   d o   n o t   s e e   t h e   e n d p o i n t s ,   s e e   t h e   e n d p o i n t s   s e c t i o n   i n   t h e   d e b u g g i n g   S e r v i c e s   d o c u m e n t a t i o n .   F o r   a d d i t i o n a l   K u b e r n e t e s   D N S   e x a m p l e s ,   s e e   t h e   c l u s t e r - d n s   e x a m p l e s   i n   t h e   K u b e r n e t e s   G i t H u b   r e p o s i t o r y .


Question: What is Are DNS queries being received/processed??

Answer: Y o u   c a n   v e r i f y   i f   q u e r i e s   a r e   b e i n g   r e c e i v e d   b y   C o r e D N S   b y   a d d i n g   t h e   l o g   p l u g i n   t o   t h e   C o r e D N S   c o n f i g u r a t i o n   ( a k a   C o r e f i l e ) .   T h e   C o r e D N S   C o r e f i l e   i s   h e l d   i n   a   C o n f i g M a p   n a m e d   c o r e d n s .   T o   e d i t   i t ,   u s e   t h e   c o m m a n d :   k u b e c t l   - n   k u b e - s y s t e m   e d i t   c o n f i g m a p   c o r e d n s   T h e n   a d d   l o g   i n   t h e   C o r e f i l e   s e c t i o n   p e r   t h e   e x a m p l e   b e l o w :   a p i V e r s i o n :   v 1   k i n d :   C o n f i g M a p   m e t a d a t a :   n a m e :   c o r e d n s   n a m e s p a c e :   k u b e - s y s t e m   d a t a :   C o r e f i l e :   |   . : 5 3   {   l o g   e r r o r s   h e a l t h   k u b e r n e t e s   c l u s t e r . l o c a l   i n - a d d r . a r p a   i p 6 . a r p a   {   p o d s   i n s e c u r e   u p s t r e a m   f a l l t h r o u g h   i n - a d d r . a r p a   i p 6 . a r p a   }   p r o m e t h e u s   : 9 1 5 3   f o r w a r d   .   / e t c / r e s o l v . c o n f   c a c h e   3 0   l o o p   r e l o a d   l o a d b a l a n c e   }   A f t e r   s a v i n g   t h e   c h a n g e s ,   i t   m a y   t a k e   u p   t o   m i n u t e   o r   t w o   f o r   K u b e r n e t e s   t o   p r o p a g a t e   t h e s e   c h a n g e s   t o   t h e   C o r e D N S   p o d s .   N e x t ,   m a k e   s o m e   q u e r i e s   a n d   v i e w   t h e   l o g s   p e r   t h e   s e c t i o n s   a b o v e   i n   t h i s   d o c u m e n t .   I f   C o r e D N S   p o d s   a r e   r e c e i v i n g   t h e   q u e r i e s ,   y o u   s h o u l d   s e e   t h e m   i n   t h e   l o g s .   H e r e   i s   a n   e x a m p l e   o f   a   q u e r y   i n   t h e   l o g :   . : 5 3   2 0 1 8 / 0 8 / 1 5   1 4 : 3 7 : 1 5   [ I N F O ]   C o r e D N S - 1 . 2 . 0   2 0 1 8


Question: What is Does CoreDNS have sufficient permissions??

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


Question: What is Are you in the right namespace for the service??

Answer: D N S   q u e r i e s   t h a t   d o n ' t   s p e c i f y   a   n a m e s p a c e   a r e   l i m i t e d   t o   t h e   p o d ' s   n a m e s p a c e .   I f   t h e   n a m e s p a c e   o f   t h e   p o d   a n d   s e r v i c e   d i f f e r ,   t h e   D N S   q u e r y   m u s t   i n c l u d e   t h e   n a m e s p a c e   o f   t h e   s e r v i c e .   T h i s   q u e r y   i s   l i m i t e d   t o   t h e   p o d ' s   n a m e s p a c e :   k u b e c t l   e x e c   - i   - t   d n s u t i l s   - -   n s l o o k u p   < s e r v i c e - n a m e >   T h i s   q u e r y   s p e c i f i e s   t h e   n a m e s p a c e :   k u b e c t l   e x e c   - i   - t   d n s u t i l s   - -   n s l o o k u p   < s e r v i c e - n a m e > . < n a m e s p a c e >   T o   l e a r n   m o r e   a b o u t   n a m e   r e s o l u t i o n ,   s e e   D N S   f o r   S e r v i c e s   a n d   P o d s .


Question: What is Known issues?

Answer: S o m e   L i n u x   d i s t r i b u t i o n s   ( e . g .   U b u n t u )   u s e   a   l o c a l   D N S   r e s o l v e r   b y   d e f a u l t   ( s y s t e m d - r e s o l v e d ) .   S y s t e m d - r e s o l v e d   m o v e s   a n d   r e p l a c e s   / e t c / r e s o l v . c o n f   w i t h   a   s t u b   f i l e   t h a t   c a n   c a u s e   a   f a t a l   f o r w a r d i n g   l o o p   w h e n   r e s o l v i n g   n a m e s   i n   u p s t r e a m   s e r v e r s .   T h i s   c a n   b e   f i x e d   m a n u a l l y   b y   u s i n g   k u b e l e t ' s   - - r e s o l v - c o n f   f l a g   t o   p o i n t   t o   t h e   c o r r e c t   r e s o l v . c o n f   ( W i t h   s y s t e m d - r e s o l v e d ,   t h i s   i s   / r u n / s y s t e m d / r e s o l v e / r e s o l v . c o n f ) .   k u b e a d m   a u t o m a t i c a l l y   d e t e c t s   s y s t e m d - r e s o l v e d ,   a n d   a d j u s t s   t h e   k u b e l e t   f l a g s   a c c o r d i n g l y .   K u b e r n e t e s   i n s t a l l s   d o   n o t   c o n f i g u r e   t h e   n o d e s '   r e s o l v . c o n f   f i l e s   t o   u s e   t h e   c l u s t e r   D N S   b y   d e f a u l t ,   b e c a u s e   t h a t   p r o c e s s   i s   i n h e r e n t l y   d i s t r i b u t i o n - s p e c i f i c .   T h i s   s h o u l d   p r o b a b l y   b e   i m p l e m e n t e d   e v e n t u a l l y .   L i n u x ' s   l i b c   ( a . k . a .   g l i b c )   h a s   a   l i m i t   f o r   t h e   D N S   n a m e s e r v e r   r e c o r d s   t o   3   b y   d e f a u l t   a n d   K u b e r n e t e s   n e e d s   t o   c o n s u m e   1   n a m e s e r v e r   r e c o r d .   T h i s   m e a n s   t h a t   i f   a   l o c a l   i n s t a l l a t i o n   a l r e a d y   u s e s   3   n a m e s e r v e r s ,   s o m e   o f   t h o s e   e n t r i e s   w i l l   b e   l o s t .   T o   w o r k   a r o u n d   t h i s   l i m i t ,   t h e   n o d e   c a n   r u n


Question: What is What's next?

Answer: S e e   A u t o s c a l i n g   t h e   D N S   S e r v i c e   i n   a   C l u s t e r . R e a d   D N S   f o r   S e r v i c e s   a n d   P o d s


Question: What is Adding entries to Pod /etc/hosts with HostAliases?

Answer: Adding entries to Pod /etc/hosts with HostAliasesAdding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.The Kubernetes project recommends modifying DNS configuration using the hostAliases field (part of the .spec for a Pod), and not by using an init container or other means to edit /etc/hosts directly. Change made in other ways may be overwritten by the kubelet during Pod creation or restart.Default hosts file contentStart an Nginx Pod which is assigned a Pod IP:kubectl run nginx --image nginx pod/nginx created Examine a Pod IP:kubectl get pods --output=wide NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 The hosts file content would look like this:kubectl exec nginx -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.4 nginx By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.Adding additional entries with hostAliasesIn addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:service/networking/hostaliases-pod.yaml apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: "127.0.0.1" hostnames: - "foo.local" - "bar.local" - ip: "10.1.2.3" hostnames: - "foo.remote" - "bar.remote" containers: - name: cat-hosts image: busybox:1.28 command: - cat args: - "/etc/hosts" You can start a Pod with that configuration by running:kubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml pod/hostaliases-pod created Examine a Pod's details to see its IPv4 address and its status:kubectl get pod --output=wide NAME READY STATUS RESTARTS AGE IP NODE hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0 The hosts file content looks like this:kubectl logs hostaliases-pod # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.5 hostaliases-pod # Entries added by HostAliases. 127.0.0.1 foo.local bar.local 10.1.2.3 foo.remote bar.remote with the additional entries specified at the bottom.Why does the kubelet manage the hosts file?The kubelet manages the hosts file for each container of the Pod to prevent the container runtime from modifying the file after the containers have already been started. Historically, Kubernetes always used Docker Engine as its container runtime, and Docker Engine would then modify the /etc/hosts file after each container had started.Current Kubernetes can use a


Question: How does Adding entries to Pod /etc/hosts with HostAliases work?

Answer: Adding entries to Pod /etc/hosts with HostAliasesAdding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.The Kubernetes project recommends modifying DNS configuration using the hostAliases field (part of the .spec for a Pod), and not by using an init container or other means to edit /etc/hosts directly. Change made in other ways may be overwritten by the kubelet during Pod creation or restart.Default hosts file contentStart an Nginx Pod which is assigned a Pod IP:kubectl run nginx --image nginx pod/nginx created Examine a Pod IP:kubectl get pods --output=wide NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 The hosts file content would look like this:kubectl exec nginx -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.4 nginx By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.Adding additional entries with hostAliasesIn addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:service/networking/hostaliases-pod.yaml apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: "127.0.0.1" hostnames: - "foo.local" - "bar.local" - ip: "10.1.2.3" hostnames: - "foo.remote" - "bar.remote" containers: - name: cat-hosts image: busybox:1.28 command: - cat args: - "/etc/hosts" You can start a Pod with that configuration by running:kubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml pod/hostaliases-pod created Examine a Pod's details to see its IPv4 address and its status:kubectl get pod --output=wide NAME READY STATUS RESTARTS AGE IP NODE hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0 The hosts file content looks like this:kubectl logs hostaliases-pod # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.5 hostaliases-pod # Entries added by HostAliases. 127.0.0.1 foo.local bar.local 10.1.2.3 foo.remote bar.remote with the additional entries specified at the bottom.Why does the kubelet manage the hosts file?The kubelet manages the hosts file for each container of the Pod to prevent the container runtime from modifying the file after the containers have already been started. Historically, Kubernetes always used Docker Engine as its container runtime, and Docker Engine would then modify the /etc/hosts file after each container had started.Current Kubernetes can use a


Question: When would you use Adding entries to Pod /etc/hosts with HostAliases?

Answer: Adding entries to Pod /etc/hosts with HostAliasesAdding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.The Kubernetes project recommends modifying DNS configuration using the hostAliases field (part of the .spec for a Pod), and not by using an init container or other means to edit /etc/hosts directly. Change made in other ways may be overwritten by the kubelet during Pod creation or restart.Default hosts file contentStart an Nginx Pod which is assigned a Pod IP:kubectl run nginx --image nginx pod/nginx created Examine a Pod IP:kubectl get pods --output=wide NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 The hosts file content would look like this:kubectl exec nginx -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.4 nginx By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.Adding additional entries with hostAliasesIn addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:service/networking/hostaliases-pod.yaml apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: "127.0.0.1" hostnames: - "foo.local" - "bar.local" - ip: "10.1.2.3" hostnames: - "foo.remote" - "bar.remote" containers: - name: cat-hosts image: busybox:1.28 command: - cat args: - "/etc/hosts" You can start a Pod with that configuration by running:kubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml pod/hostaliases-pod created Examine a Pod's details to see its IPv4 address and its status:kubectl get pod --output=wide NAME READY STATUS RESTARTS AGE IP NODE hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0 The hosts file content looks like this:kubectl logs hostaliases-pod # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.5 hostaliases-pod # Entries added by HostAliases. 127.0.0.1 foo.local bar.local 10.1.2.3 foo.remote bar.remote with the additional entries specified at the bottom.Why does the kubelet manage the hosts file?The kubelet manages the hosts file for each container of the Pod to prevent the container runtime from modifying the file after the containers have already been started. Historically, Kubernetes always used Docker Engine as its container runtime, and Docker Engine would then modify the /etc/hosts file after each container had started.Current Kubernetes can use a


Question: What are the benefits of Adding entries to Pod /etc/hosts with HostAliases?

Answer: Adding entries to Pod /etc/hosts with HostAliasesAdding entries to a Pod's /etc/hosts file provides Pod-level override of hostname resolution when DNS and other options are not applicable. You can add these custom entries with the HostAliases field in PodSpec.The Kubernetes project recommends modifying DNS configuration using the hostAliases field (part of the .spec for a Pod), and not by using an init container or other means to edit /etc/hosts directly. Change made in other ways may be overwritten by the kubelet during Pod creation or restart.Default hosts file contentStart an Nginx Pod which is assigned a Pod IP:kubectl run nginx --image nginx pod/nginx created Examine a Pod IP:kubectl get pods --output=wide NAME READY STATUS RESTARTS AGE IP NODE nginx 1/1 Running 0 13s 10.200.0.4 worker0 The hosts file content would look like this:kubectl exec nginx -- cat /etc/hosts # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.4 nginx By default, the hosts file only includes IPv4 and IPv6 boilerplates like localhost and its own hostname.Adding additional entries with hostAliasesIn addition to the default boilerplate, you can add additional entries to the hosts file. For example: to resolve foo.local, bar.local to 127.0.0.1 and foo.remote, bar.remote to 10.1.2.3, you can configure HostAliases for a Pod under .spec.hostAliases:service/networking/hostaliases-pod.yaml apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: "127.0.0.1" hostnames: - "foo.local" - "bar.local" - ip: "10.1.2.3" hostnames: - "foo.remote" - "bar.remote" containers: - name: cat-hosts image: busybox:1.28 command: - cat args: - "/etc/hosts" You can start a Pod with that configuration by running:kubectl apply -f https://k8s.io/examples/service/networking/hostaliases-pod.yaml pod/hostaliases-pod created Examine a Pod's details to see its IPv4 address and its status:kubectl get pod --output=wide NAME READY STATUS RESTARTS AGE IP NODE hostaliases-pod 0/1 Completed 0 6s 10.200.0.5 worker0 The hosts file content looks like this:kubectl logs hostaliases-pod # Kubernetes-managed hosts file. 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet fe00::0 ip6-mcastprefix fe00::1 ip6-allnodes fe00::2 ip6-allrouters 10.200.0.5 hostaliases-pod # Entries added by HostAliases. 127.0.0.1 foo.local bar.local 10.1.2.3 foo.remote bar.remote with the additional entries specified at the bottom.Why does the kubelet manage the hosts file?The kubelet manages the hosts file for each container of the Pod to prevent the container runtime from modifying the file after the containers have already been started. Historically, Kubernetes always used Docker Engine as its container runtime, and Docker Engine would then modify the /etc/hosts file after each container had started.Current Kubernetes can use a


Question: What is Adding entries to Pod /etc/hosts with HostAliases?

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


Question: What is Default hosts file content?

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


Question: What is Adding additional entries with hostAliases?

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


Question: What is Why does the kubelet manage the hosts file??

Answer: T h e   k u b e l e t   m a n a g e s   t h e   h o s t s   f i l e   f o r   e a c h   c o n t a i n e r   o f   t h e   P o d   t o   p r e v e n t   t h e   c o n t a i n e r   r u n t i m e   f r o m   m o d i f y i n g   t h e   f i l e   a f t e r   t h e   c o n t a i n e r s   h a v e   a l r e a d y   b e e n   s t a r t e d .   H i s t o r i c a l l y ,   K u b e r n e t e s   a l w a y s   u s e d   D o c k e r   E n g i n e   a s   i t s   c o n t a i n e r   r u n t i m e ,   a n d   D o c k e r   E n g i n e   w o u l d   t h e n   m o d i f y   t h e   / e t c / h o s t s   f i l e   a f t e r   e a c h   c o n t a i n e r   h a d   s t a r t e d .   C u r r e n t   K u b e r n e t e s   c a n   u s e   a   v a r i e t y   o f   c o n t a i n e r   r u n t i m e s ;   e v e n   s o ,   t h e   k u b e l e t   m a n a g e s   t h e   h o s t s   f i l e   w i t h i n   e a c h   c o n t a i n e r   s o   t h a t   t h e   o u t c o m e   i s   a s   i n t e n d e d   r e g a r d l e s s   o f   w h i c h   c o n t a i n e r   r u n t i m e   y o u   u s e .


Question: What is Caution:?

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


Question: What is Kubernetes Object Management?

Answer: Kubernetes Object ManagementThe kubectl command-line tool supports several different ways to create and manage Kubernetes objects. This document provides an overview of the different approaches. Read the Kubectl book for details of managing objects by Kubectl.Management techniquesWarning:A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.Management techniqueOperates onRecommended environmentSupported writersLearning curveImperative commandsLive objectsDevelopment projects1+LowestImperative object configurationIndividual filesProduction projects1ModerateDeclarative object configurationDirectories of filesProduction projects1+HighestImperative commandsWhen using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.This is the recommended way to get started or to run a one-off task in a cluster. Because this technique operates directly on live objects, it provides no history of previous configurations.ExamplesRun an instance of the nginx container by creating a Deployment object:kubectl create deployment nginx --image nginx Trade-offsAdvantages compared to object configuration:Commands are expressed as a single action word.Commands require only a single step to make changes to the cluster.Disadvantages compared to object configuration:Commands do not integrate with change review processes.Commands do not provide an audit trail associated with changes.Commands do not provide a source of records except for what is live.Commands do not provide a template for creating new objects.Imperative object configurationIn imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.See the API reference for more details on object definitions.Warning:The imperative replace command replaces the existing spec with the newly provided one, dropping all changes to the object missing from the configuration file. This approach should not be used with resource types whose specs are updated independently of the configuration file. Services of type LoadBalancer, for example, have their externalIPs field updated independently from the configuration by the cluster.ExamplesCreate the objects defined in a configuration file:kubectl create -f nginx.yaml Delete the objects defined in two configuration files:kubectl delete -f nginx.yaml -f redis.yaml Update the objects defined in a configuration file by overwriting the live configuration:kubectl replace -f nginx.yaml Trade-offsAdvantages compared to imperative commands:Object configuration can be stored in a source control system such as Git.Object configuration can integrate with processes such as reviewing changes before push and audit trails.Object configuration provides


Question: How does Kubernetes Object Management work?

Answer: Kubernetes Object ManagementThe kubectl command-line tool supports several different ways to create and manage Kubernetes objects. This document provides an overview of the different approaches. Read the Kubectl book for details of managing objects by Kubectl.Management techniquesWarning:A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.Management techniqueOperates onRecommended environmentSupported writersLearning curveImperative commandsLive objectsDevelopment projects1+LowestImperative object configurationIndividual filesProduction projects1ModerateDeclarative object configurationDirectories of filesProduction projects1+HighestImperative commandsWhen using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.This is the recommended way to get started or to run a one-off task in a cluster. Because this technique operates directly on live objects, it provides no history of previous configurations.ExamplesRun an instance of the nginx container by creating a Deployment object:kubectl create deployment nginx --image nginx Trade-offsAdvantages compared to object configuration:Commands are expressed as a single action word.Commands require only a single step to make changes to the cluster.Disadvantages compared to object configuration:Commands do not integrate with change review processes.Commands do not provide an audit trail associated with changes.Commands do not provide a source of records except for what is live.Commands do not provide a template for creating new objects.Imperative object configurationIn imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.See the API reference for more details on object definitions.Warning:The imperative replace command replaces the existing spec with the newly provided one, dropping all changes to the object missing from the configuration file. This approach should not be used with resource types whose specs are updated independently of the configuration file. Services of type LoadBalancer, for example, have their externalIPs field updated independently from the configuration by the cluster.ExamplesCreate the objects defined in a configuration file:kubectl create -f nginx.yaml Delete the objects defined in two configuration files:kubectl delete -f nginx.yaml -f redis.yaml Update the objects defined in a configuration file by overwriting the live configuration:kubectl replace -f nginx.yaml Trade-offsAdvantages compared to imperative commands:Object configuration can be stored in a source control system such as Git.Object configuration can integrate with processes such as reviewing changes before push and audit trails.Object configuration provides


Question: When would you use Kubernetes Object Management?

Answer: Kubernetes Object ManagementThe kubectl command-line tool supports several different ways to create and manage Kubernetes objects. This document provides an overview of the different approaches. Read the Kubectl book for details of managing objects by Kubectl.Management techniquesWarning:A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.Management techniqueOperates onRecommended environmentSupported writersLearning curveImperative commandsLive objectsDevelopment projects1+LowestImperative object configurationIndividual filesProduction projects1ModerateDeclarative object configurationDirectories of filesProduction projects1+HighestImperative commandsWhen using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.This is the recommended way to get started or to run a one-off task in a cluster. Because this technique operates directly on live objects, it provides no history of previous configurations.ExamplesRun an instance of the nginx container by creating a Deployment object:kubectl create deployment nginx --image nginx Trade-offsAdvantages compared to object configuration:Commands are expressed as a single action word.Commands require only a single step to make changes to the cluster.Disadvantages compared to object configuration:Commands do not integrate with change review processes.Commands do not provide an audit trail associated with changes.Commands do not provide a source of records except for what is live.Commands do not provide a template for creating new objects.Imperative object configurationIn imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.See the API reference for more details on object definitions.Warning:The imperative replace command replaces the existing spec with the newly provided one, dropping all changes to the object missing from the configuration file. This approach should not be used with resource types whose specs are updated independently of the configuration file. Services of type LoadBalancer, for example, have their externalIPs field updated independently from the configuration by the cluster.ExamplesCreate the objects defined in a configuration file:kubectl create -f nginx.yaml Delete the objects defined in two configuration files:kubectl delete -f nginx.yaml -f redis.yaml Update the objects defined in a configuration file by overwriting the live configuration:kubectl replace -f nginx.yaml Trade-offsAdvantages compared to imperative commands:Object configuration can be stored in a source control system such as Git.Object configuration can integrate with processes such as reviewing changes before push and audit trails.Object configuration provides


Question: What are the benefits of Kubernetes Object Management?

Answer: Kubernetes Object ManagementThe kubectl command-line tool supports several different ways to create and manage Kubernetes objects. This document provides an overview of the different approaches. Read the Kubectl book for details of managing objects by Kubectl.Management techniquesWarning:A Kubernetes object should be managed using only one technique. Mixing and matching techniques for the same object results in undefined behavior.Management techniqueOperates onRecommended environmentSupported writersLearning curveImperative commandsLive objectsDevelopment projects1+LowestImperative object configurationIndividual filesProduction projects1ModerateDeclarative object configurationDirectories of filesProduction projects1+HighestImperative commandsWhen using imperative commands, a user operates directly on live objects in a cluster. The user provides operations to the kubectl command as arguments or flags.This is the recommended way to get started or to run a one-off task in a cluster. Because this technique operates directly on live objects, it provides no history of previous configurations.ExamplesRun an instance of the nginx container by creating a Deployment object:kubectl create deployment nginx --image nginx Trade-offsAdvantages compared to object configuration:Commands are expressed as a single action word.Commands require only a single step to make changes to the cluster.Disadvantages compared to object configuration:Commands do not integrate with change review processes.Commands do not provide an audit trail associated with changes.Commands do not provide a source of records except for what is live.Commands do not provide a template for creating new objects.Imperative object configurationIn imperative object configuration, the kubectl command specifies the operation (create, replace, etc.), optional flags and at least one file name. The file specified must contain a full definition of the object in YAML or JSON format.See the API reference for more details on object definitions.Warning:The imperative replace command replaces the existing spec with the newly provided one, dropping all changes to the object missing from the configuration file. This approach should not be used with resource types whose specs are updated independently of the configuration file. Services of type LoadBalancer, for example, have their externalIPs field updated independently from the configuration by the cluster.ExamplesCreate the objects defined in a configuration file:kubectl create -f nginx.yaml Delete the objects defined in two configuration files:kubectl delete -f nginx.yaml -f redis.yaml Update the objects defined in a configuration file by overwriting the live configuration:kubectl replace -f nginx.yaml Trade-offsAdvantages compared to imperative commands:Object configuration can be stored in a source control system such as Git.Object configuration can integrate with processes such as reviewing changes before push and audit trails.Object configuration provides


Question: What is Kubernetes Object Management?

Answer: 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   s u p p o r t s   s e v e r a l   d i f f e r e n t   w a y s   t o   c r e a t e   a n d   m a n a g e   K u b e r n e t e s   o b j e c t s .   T h i s   d o c u m e n t   p r o v i d e s   a n   o v e r v i e w   o f   t h e   d i f f e r e n t   a p p r o a c h e s .   R e a d   t h e   K u b e c t l   b o o k   f o r   d e t a i l s   o f   m a n a g i n g   o b j e c t s   b y   K u b e c t l .


Question: What is Imperative commands?

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


Question: What is Examples?

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


Question: What is Trade-offs?

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


Question: What is Imperative object configuration?

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


Question: What is Examples?

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


Question: What is Trade-offs?

Answer: A d v a n t a g e s   c o m p a r e d   t o   i m p e r a t i v e   c o m m a n d s :   O b j e c t   c o n f i g u r a t i o n   c a n   b e   s t o r e d   i n   a   s o u r c e   c o n t r o l   s y s t e m   s u c h   a s   G i t . O b j e c t   c o n f i g u r a t i o n   c a n   i n t e g r a t e   w i t h   p r o c e s s e s   s u c h   a s   r e v i e w i n g   c h a n g e s   b e f o r e   p u s h   a n d   a u d i t   t r a i l s . O b j e c t   c o n f i g u r a t i o n   p r o v i d e s   a   t e m p l a t e   f o r   c r e a t i n g   n e w   o b j e c t s .   D i s a d v a n t a g e s   c o m p a r e d   t o   i m p e r a t i v e   c o m m a n d s :   O b j e c t   c o n f i g u r a t i o n   r e q u i r e s   b a s i c   u n d e r s t a n d i n g   o f   t h e   o b j e c t   s c h e m a . O b j e c t   c o n f i g u r a t i o n   r e q u i r e s   t h e   a d d i t i o n a l   s t e p   o f   w r i t i n g   a   Y A M L   f i l e .   A d v a n t a g e s   c o m p a r e d   t o   d e c l a r a t i v e   o b j e c t   c o n f i g u r a t i o n :   I m p e r a t i v e   o b j e c t   c o n f i g u r a t i o n   b e h a v i o r   i s   s i m p l e r   a n d   e a s i e r   t o   u n d e r s t a n d . A s   o f   K u b e r n e t e s   v e r s i o n   1 . 5 ,   i m p e r a t i v e   o b j e c t   c o n f i g u r a t i o n   i s   m o r e   m a t u r e .   D i s a d v a n t a g e s   c o m p a r e d   t o   d e c l a r a t i v e   o b j e c t   c o n f i g u r a t i o n :   I m p e r a t i v e   o b j e c t   c o n f i g u r a t i o n   w o r k s   b e s t   o n   f i l e s ,   n o t   d i r e c t o r i e s . U p d a t e s   t o   l i v e   o b j e c t s   m u s t   b e   r e f l e c t e d   i n   c o n f i g u r a t i o n   f i l e s ,   o r   t h e y   w i l l   b e   l o s t   d u r i n g   t h e   n e x t   r e p l a c e m e n t .


Question: What is Declarative object configuration?

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


Question: What is Examples?

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


Question: What is Trade-offs?

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


Question: What is What's next?

Answer: M a n a g i n g   K u b e r n e t e s   O b j e c t s   U s i n g   I m p e r a t i v e   C o m m a n d s I m p e r a t i v e   M a n a g e m e n t   o f   K u b e r n e t e s   O b j e c t s   U s i n g   C o n f i g u r a t i o n   F i l e s D e c l a r a t i v e   M a n a g e m e n t   o f   K u b e r n e t e s   O b j e c t s   U s i n g   C o n f i g u r a t i o n   F i l e s D e c l a r a t i v e   M a n a g e m e n t   o f   K u b e r n e t e s   O b j e c t s   U s i n g   K u s t o m i z e K u b e c t l   C o m m a n d   R e f e r e n c e K u b e c t l   B o o k K u b e r n e t e s   A P I   R e f e r e n c e


Question: What is kubectl api-versions?

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


Question: How does kubectl api-versions work?

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


Question: When would you use kubectl api-versions?

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


Question: What are the benefits of kubectl api-versions?

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


Question: What is Synopsis?

Answer: P r i n t   t h e   s u p p o r t e d   A P I   v e r s i o n s   o n   t h e   s e r v e r ,   i n   t h e   f o r m   o f   " g r o u p / v e r s i o n " .   k u b e c t l   a p i - v e r s i o n s


Question: What is Examples?

Answer: #   P r i n t   t h e   s u p p o r t e d   A P I   v e r s i o n s   k u b e c t l   a p i - v e r s i o n s


Question: What is Options?

Answer: h e l p   f o r   a p i - v e r s i o n s


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 Service Internal Traffic Policy?

Answer: Service Internal Traffic PolicyIf two Pods in your cluster want to communicate, and both Pods are actually running on the same node, use Service Internal Traffic Policy to keep network traffic within that node. Avoiding a round trip via the cluster network can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.26 [stable]Service Internal Traffic Policy enables internal traffic restrictions to only route internal traffic to endpoints within the node the traffic originated from. The "internal" traffic here refers to traffic originated from Pods in the current cluster. This can help to reduce costs and improve performance.Using Service Internal Traffic PolicyYou can enable the internal-only traffic policy for a Service, by setting its .spec.internalTrafficPolicy to Local. This tells kube-proxy to only use node local endpoints for cluster internal traffic.Note:For pods on nodes with no endpoints for a given Service, the Service behaves as if it has zero endpoints (for Pods on this node) even if the service does have endpoints on other nodes.The following example shows what a Service looks like when you set .spec.internalTrafficPolicy to Local:apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 internalTrafficPolicy: Local How it worksThe kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or is not set, Kubernetes considers all endpoints.What's nextRead about Topology Aware RoutingRead about Service External Traffic PolicyFollow the Connecting Applications with Services tutorial


Question: How does Service Internal Traffic Policy work?

Answer: Service Internal Traffic PolicyIf two Pods in your cluster want to communicate, and both Pods are actually running on the same node, use Service Internal Traffic Policy to keep network traffic within that node. Avoiding a round trip via the cluster network can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.26 [stable]Service Internal Traffic Policy enables internal traffic restrictions to only route internal traffic to endpoints within the node the traffic originated from. The "internal" traffic here refers to traffic originated from Pods in the current cluster. This can help to reduce costs and improve performance.Using Service Internal Traffic PolicyYou can enable the internal-only traffic policy for a Service, by setting its .spec.internalTrafficPolicy to Local. This tells kube-proxy to only use node local endpoints for cluster internal traffic.Note:For pods on nodes with no endpoints for a given Service, the Service behaves as if it has zero endpoints (for Pods on this node) even if the service does have endpoints on other nodes.The following example shows what a Service looks like when you set .spec.internalTrafficPolicy to Local:apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 internalTrafficPolicy: Local How it worksThe kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or is not set, Kubernetes considers all endpoints.What's nextRead about Topology Aware RoutingRead about Service External Traffic PolicyFollow the Connecting Applications with Services tutorial


Question: When would you use Service Internal Traffic Policy?

Answer: Service Internal Traffic PolicyIf two Pods in your cluster want to communicate, and both Pods are actually running on the same node, use Service Internal Traffic Policy to keep network traffic within that node. Avoiding a round trip via the cluster network can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.26 [stable]Service Internal Traffic Policy enables internal traffic restrictions to only route internal traffic to endpoints within the node the traffic originated from. The "internal" traffic here refers to traffic originated from Pods in the current cluster. This can help to reduce costs and improve performance.Using Service Internal Traffic PolicyYou can enable the internal-only traffic policy for a Service, by setting its .spec.internalTrafficPolicy to Local. This tells kube-proxy to only use node local endpoints for cluster internal traffic.Note:For pods on nodes with no endpoints for a given Service, the Service behaves as if it has zero endpoints (for Pods on this node) even if the service does have endpoints on other nodes.The following example shows what a Service looks like when you set .spec.internalTrafficPolicy to Local:apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 internalTrafficPolicy: Local How it worksThe kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or is not set, Kubernetes considers all endpoints.What's nextRead about Topology Aware RoutingRead about Service External Traffic PolicyFollow the Connecting Applications with Services tutorial


Question: What are the benefits of Service Internal Traffic Policy?

Answer: Service Internal Traffic PolicyIf two Pods in your cluster want to communicate, and both Pods are actually running on the same node, use Service Internal Traffic Policy to keep network traffic within that node. Avoiding a round trip via the cluster network can help with reliability, performance (network latency and throughput), or cost.FEATURE STATE: Kubernetes v1.26 [stable]Service Internal Traffic Policy enables internal traffic restrictions to only route internal traffic to endpoints within the node the traffic originated from. The "internal" traffic here refers to traffic originated from Pods in the current cluster. This can help to reduce costs and improve performance.Using Service Internal Traffic PolicyYou can enable the internal-only traffic policy for a Service, by setting its .spec.internalTrafficPolicy to Local. This tells kube-proxy to only use node local endpoints for cluster internal traffic.Note:For pods on nodes with no endpoints for a given Service, the Service behaves as if it has zero endpoints (for Pods on this node) even if the service does have endpoints on other nodes.The following example shows what a Service looks like when you set .spec.internalTrafficPolicy to Local:apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 internalTrafficPolicy: Local How it worksThe kube-proxy filters the endpoints it routes to based on the spec.internalTrafficPolicy setting. When it's set to Local, only node local endpoints are considered. When it's Cluster (the default), or is not set, Kubernetes considers all endpoints.What's nextRead about Topology Aware RoutingRead about Service External Traffic PolicyFollow the Connecting Applications with Services tutorial


Question: What is Service Internal Traffic Policy?

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


Question: What is Using Service Internal Traffic Policy?

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


Question: What is Note:?

Answer: T h e   f o l l o w i n g   e x a m p l e   s h o w s   w h a t   a   S e r v i c e   l o o k s   l i k e   w h e n   y o u   s e t   . s p e c . i n t e r n a l T r a f f i c P o l i c y   t o   L o c a l :   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 :   m y - s e r v i c e   s p e c :   s e l e c t o r :   a p p . k u b e r n e t e s . i o / n a m e :   M y A p p   p o r t s :   -   p r o t o c o l :   T C P   p o r t :   8 0   t a r g e t P o r t :   9 3 7 6   i n t e r n a l T r a f f i c P o l i c y :   L o c a l


Question: What is How it works?

Answer: T h e   k u b e - p r o x y   f i l t e r s   t h e   e n d p o i n t s   i t   r o u t e s   t o   b a s e d   o n   t h e   s p e c . i n t e r n a l T r a f f i c P o l i c y   s e t t i n g .   W h e n   i t ' s   s e t   t o   L o c a l ,   o n l y   n o d e   l o c a l   e n d p o i n t s   a r e   c o n s i d e r e d .   W h e n   i t ' s   C l u s t e r   ( t h e   d e f a u l t ) ,   o r   i s   n o t   s e t ,   K u b e r n e t e s   c o n s i d e r s   a l l   e n d p o i n t s .


Question: What is What's next?

Answer: R e a d   a b o u t   T o p o l o g y   A w a r e   R o u t i n g R e a d   a b o u t   S e r v i c e   E x t e r n a l   T r a f f i c   P o l i c y F o l l o w   t h e   C o n n e c t i n g   A p p l i c a t i o n s   w i t h   S e r v i c e s   t u t o r i a l


Question: What is kubectl annotate?

Answer: kubectl annotateSynopsisUpdate the annotations on one or more resources.All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.Use "kubectl api-resources" for a complete list of supported resources.kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the annotation 'description' and the value 'my frontend' # If the same annotation is set multiple times, only the last value will be applied kubectl annotate pods foo description='my frontend' # Update a pod identified by type and name in "pod.json" kubectl annotate -f pod.json description='my frontend' # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value kubectl annotate --overwrite pods foo description='my frontend running nginx' # Update all pods in the namespace kubectl annotate pods --all description='my frontend running nginx' # Update pod 'foo' only if the resource is unchanged from version 1 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 # Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag kubectl annotate pods foo description- Options--allSelect all resources, in the namespace of the specified resource types.-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[="unchanged"] Default: "none"Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: "kubectl-annotate"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the annotation-h, --helphelp for annotate-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the annotations for a given resource.--localIf true, annotation will NOT contact api-server but run locally.-o, --output s


Question: How does kubectl annotate work?

Answer: kubectl annotateSynopsisUpdate the annotations on one or more resources.All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.Use "kubectl api-resources" for a complete list of supported resources.kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the annotation 'description' and the value 'my frontend' # If the same annotation is set multiple times, only the last value will be applied kubectl annotate pods foo description='my frontend' # Update a pod identified by type and name in "pod.json" kubectl annotate -f pod.json description='my frontend' # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value kubectl annotate --overwrite pods foo description='my frontend running nginx' # Update all pods in the namespace kubectl annotate pods --all description='my frontend running nginx' # Update pod 'foo' only if the resource is unchanged from version 1 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 # Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag kubectl annotate pods foo description- Options--allSelect all resources, in the namespace of the specified resource types.-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[="unchanged"] Default: "none"Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: "kubectl-annotate"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the annotation-h, --helphelp for annotate-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the annotations for a given resource.--localIf true, annotation will NOT contact api-server but run locally.-o, --output s


Question: When would you use kubectl annotate?

Answer: kubectl annotateSynopsisUpdate the annotations on one or more resources.All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.Use "kubectl api-resources" for a complete list of supported resources.kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the annotation 'description' and the value 'my frontend' # If the same annotation is set multiple times, only the last value will be applied kubectl annotate pods foo description='my frontend' # Update a pod identified by type and name in "pod.json" kubectl annotate -f pod.json description='my frontend' # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value kubectl annotate --overwrite pods foo description='my frontend running nginx' # Update all pods in the namespace kubectl annotate pods --all description='my frontend running nginx' # Update pod 'foo' only if the resource is unchanged from version 1 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 # Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag kubectl annotate pods foo description- Options--allSelect all resources, in the namespace of the specified resource types.-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[="unchanged"] Default: "none"Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: "kubectl-annotate"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the annotation-h, --helphelp for annotate-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the annotations for a given resource.--localIf true, annotation will NOT contact api-server but run locally.-o, --output s


Question: What are the benefits of kubectl annotate?

Answer: kubectl annotateSynopsisUpdate the annotations on one or more resources.All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary string values such as structured JSON. Tools and system extensions may use annotations to store their own data.Attempting to set an annotation that already exists will fail unless --overwrite is set. If --resource-version is specified and does not match the current resource version on the server the command will fail.Use "kubectl api-resources" for a complete list of supported resources.kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version] Examples # Update pod 'foo' with the annotation 'description' and the value 'my frontend' # If the same annotation is set multiple times, only the last value will be applied kubectl annotate pods foo description='my frontend' # Update a pod identified by type and name in "pod.json" kubectl annotate -f pod.json description='my frontend' # Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value kubectl annotate --overwrite pods foo description='my frontend running nginx' # Update all pods in the namespace kubectl annotate pods --all description='my frontend running nginx' # Update pod 'foo' only if the resource is unchanged from version 1 kubectl annotate pods foo description='my frontend running nginx' --resource-version=1 # Update pod 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag kubectl annotate pods foo description- Options--allSelect all resources, in the namespace of the specified resource types.-A, --all-namespacesIf true, check the specified action in all namespaces.--allow-missing-template-keys Default: trueIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.--dry-run string[="unchanged"] Default: "none"Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.--field-manager string Default: "kubectl-annotate"Name of the manager used to track field ownership.--field-selector stringSelector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.-f, --filename stringsFilename, directory, or URL to files identifying the resource to update the annotation-h, --helphelp for annotate-k, --kustomize stringProcess the kustomization directory. This flag can't be used together with -f or -R.--listIf true, display the annotations for a given resource.--localIf true, annotation will NOT contact api-server but run locally.-o, --output s


Question: What is Synopsis?

Answer: U p d a t e   t h e   a n n o t a t i o n s   o n   o n e   o r   m o r e   r e s o u r c e s .   A l l   K u b e r n e t e s   o b j e c t s   s u p p o r t   t h e   a b i l i t y   t o   s t o r e   a d d i t i o n a l   d a t a   w i t h   t h e   o b j e c t   a s   a n n o t a t i o n s .   A n n o t a t i o n s   a r e   k e y / v a l u e   p a i r s   t h a t   c a n   b e   l a r g e r   t h a n   l a b e l s   a n d   i n c l u d e   a r b i t r a r y   s t r i n g   v a l u e s   s u c h   a s   s t r u c t u r e d   J S O N .   T o o l s   a n d   s y s t e m   e x t e n s i o n s   m a y   u s e   a n n o t a t i o n s   t o   s t o r e   t h e i r   o w n   d a t a .   A t t e m p t i n g   t o   s e t   a n   a n n o t a t i o n   t h a t   a l r e a d y   e x i s t s   w i l l   f a i l   u n l e s s   - - o v e r w r i t e   i s   s e t .   I f   - - r e s o u r c e - v e r s i o n   i s   s p e c i f i e d   a n d   d o e s   n o t   m a t c h   t h e   c u r r e n t   r e s o u r c e   v e r s i o n   o n   t h e   s e r v e r   t h e   c o m m a n d   w i l l   f a i l .   U s e   " k u b e c t l   a p i - r e s o u r c e s "   f o r   a   c o m p l e t e   l i s t   o f   s u p p o r t e d   r e s o u r c e s .   k u b e c t l   a n n o t a t e   [ - - o v e r w r i t e ]   ( - f   F I L E N A M E   |   T Y P E   N A M E )   K E Y _ 1 = V A L _ 1   . . .   K E Y _ N = V A L _ N   [ - - r e s o u r c e - v e r s i o n = v e r s i o n ]


Question: What is Examples?

Answer: #   U p d a t e   p o d   ' f o o '   w i t h   t h e   a n n o t a t i o n   ' d e s c r i p t i o n '   a n d   t h e   v a l u e   ' m y   f r o n t e n d '   #   I f   t h e   s a m e   a n n o t a t i o n   i s   s e t   m u l t i p l e   t i m e s ,   o n l y   t h e   l a s t   v a l u e   w i l l   b e   a p p l i e d   k u b e c t l   a n n o t a t e   p o d s   f o o   d e s c r i p t i o n = ' m y   f r o n t e n d '   #   U p d a t e   a   p o d   i d e n t i f i e d   b y   t y p e   a n d   n a m e   i n   " p o d . j s o n "   k u b e c t l   a n n o t a t e   - f   p o d . j s o n   d e s c r i p t i o n = ' m y   f r o n t e n d '   #   U p d a t e   p o d   ' f o o '   w i t h   t h e   a n n o t a t i o n   ' d e s c r i p t i o n '   a n d   t h e   v a l u e   ' m y   f r o n t e n d   r u n n i n g   n g i n x ' ,   o v e r w r i t i n g   a n y   e x i s t i n g   v a l u e   k u b e c t l   a n n o t a t e   - - o v e r w r i t e   p o d s   f o o   d e s c r i p t i o n = ' m y   f r o n t e n d   r u n n i n g   n g i n x '   #   U p d a t e   a l l   p o d s   i n   t h e   n a m e s p a c e   k u b e c t l   a n n o t a t e   p o d s   - - a l l   d e s c r i p t i o n = ' m y   f r o n t e n d   r u n n i n g   n g i n x '   #   U p d a t e   p o d   ' f o o '   o n l y   i f   t h e   r e s o u r c e   i s   u n c h a n g e d   f r o m   v e r s i o n   1   k u b e c t l   a n n o t a t e   p o d s   f o o   d e s c r i p t i o n = ' m y   f r o n t e n d   r u n n i n g   n g i n x '   - - r e s o u r c e - v e r s i o n = 1   #   U p d a t e   p o d   ' f o o '   b y   r e m o v i n g   a n   a n n o t a t i o n   n a m e d   ' d e s c r i p t i o n '   i f   i t   e x i s t s   #   D o e s   n o t   r e q u i r e   t h e   - - o v e r w r i t e   f l a g   k u b e c t l   a n n o t a t e   p o d s   f o o   d e s c r i p t i o n -


Question: What is Options?

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