Question: What is Interacting with running Pods?

Answer: k u b e c t l   l o g s   m y - p o d   #   d u m p   p o d   l o g s   ( s t d o u t )   k u b e c t l   l o g s   - l   n a m e = m y L a b e l   #   d u m p   p o d   l o g s ,   w i t h   l a b e l   n a m e = m y L a b e l   ( s t d o u t )   k u b e c t l   l o g s   m y - p o d   - - p r e v i o u s   #   d u m p   p o d   l o g s   ( s t d o u t )   f o r   a   p r e v i o u s   i n s t a n t i a t i o n   o f   a   c o n t a i n e r   k u b e c t l   l o g s   m y - p o d   - c   m y - c o n t a i n e r   #   d u m p   p o d   c o n t a i n e r   l o g s   ( s t d o u t ,   m u l t i - c o n t a i n e r   c a s e )   k u b e c t l   l o g s   - l   n a m e = m y L a b e l   - c   m y - c o n t a i n e r   #   d u m p   p o d   c o n t a i n e r   l o g s ,   w i t h   l a b e l   n a m e = m y L a b e l   ( s t d o u t )   k u b e c t l   l o g s   m y - p o d   - c   m y - c o n t a i n e r   - - p r e v i o u s   #   d u m p   p o d   c o n t a i n e r   l o g s   ( s t d o u t ,   m u l t i - c o n t a i n e r   c a s e )   f o r   a   p r e v i o u s   i n s t a n t i a t i o n   o f   a   c o n t a i n e r   k u b e c t l   l o g s   - f   m y - p o d   #   s t r e a m   p o d   l o g s   ( s t d o u t )   k u b e c t l   l o g s   - f   m y - p o d   - c   m y - c o n t a i n e r   #   s t r e a m   p o d   c o n t a i n e r   l o g s   ( s t d o u t ,   m u l t i - c o n t a i n e r   c a s e )   k u b e c t l   l o g s   - f   - l   n a m e = m y L a b e l   - - a l l - c o n t a i n e r s   #   s t r e a m   a l l   p o d s   l o g s   w i t h   l a b e l   n a m e = m y L a b e l   ( s t d o u t )   k u b e c t l   r u n   - i   - - t t y   b u s y b o x   - - i m a g e = b u s y b o x : 1 . 2 8   - -   s h   #   R u n   p o d   a s   i n t e r a c t i v e   s h e l l   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   - n   m y n a m e s p a c e   #   S t a r t   a   s i n g l e   i n s t a n c e   o f   n g i n x   p o d   i n   t


Question: What is Copying files and directories to and from containers?

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


Question: What is Note:?

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


Question: What is Interacting with Deployments and Services?

Answer: k u b e c t l   l o g s   d e p l o y / m y - d e p l o y m e n t   #   d u m p   P o d   l o g s   f o r   a   D e p l o y m e n t   ( s i n g l e - c o n t a i n e r   c a s e )   k u b e c t l   l o g s   d e p l o y / m y - d e p l o y m e n t   - c   m y - c o n t a i n e r   #   d u m p   P o d   l o g s   f o r   a   D e p l o y m e n t   ( m u l t i - c o n t a i n e r   c a s e )   k u b e c t l   p o r t - f o r w a r d   s v c / m y - s e r v i c e   5 0 0 0   #   l i s t e n   o n   l o c a l   p o r t   5 0 0 0   a n d   f o r w a r d   t o   p o r t   5 0 0 0   o n   S e r v i c e   b a c k e n d   k u b e c t l   p o r t - f o r w a r d   s v c / m y - s e r v i c e   5 0 0 0 : m y - s e r v i c e - p o r t   #   l i s t e n   o n   l o c a l   p o r t   5 0 0 0   a n d   f o r w a r d   t o   S e r v i c e   t a r g e t   p o r t   w i t h   n a m e   < m y - s e r v i c e - p o r t >   k u b e c t l   p o r t - f o r w a r d   d e p l o y / m y - d e p l o y m e n t   5 0 0 0 : 6 0 0 0   #   l i s t e n   o n   l o c a l   p o r t   5 0 0 0   a n d   f o r w a r d   t o   p o r t   6 0 0 0   o n   a   P o d   c r e a t e d   b y   < m y - d e p l o y m e n t >   k u b e c t l   e x e c   d e p l o y / m y - d e p l o y m e n t   - -   l s   #   r u n   c o m m a n d   i n   f i r s t   P o d   a n d   f i r s t   c o n t a i n e r   i n   D e p l o y m e n t   ( s i n g l e -   o r   m u l t i - c o n t a i n e r   c a s e s )


Question: What is Interacting with Nodes and cluster?

Answer: k u b e c t l   c o r d o n   m y - n o d e   #   M a r k   m y - n o d e   a s   u n s c h e d u l a b l e   k u b e c t l   d r a i n   m y - n o d e   #   D r a i n   m y - n o d e   i n   p r e p a r a t i o n   f o r   m a i n t e n a n c e   k u b e c t l   u n c o r d o n   m y - n o d e   #   M a r k   m y - n o d e   a s   s c h e d u l a b l e   k u b e c t l   t o p   n o d e   #   S h o w   m e t r i c s   f o r   a l l   n o d e s   k u b e c t l   t o p   n o d e   m y - n o d e   #   S h o w   m e t r i c s   f o r   a   g i v e n   n o d e   k u b e c t l   c l u s t e r - i n f o   #   D i s p l a y   a d d r e s s e s   o f   t h e   m a s t e r   a n d   s e r v i c e s   k u b e c t l   c l u s t e r - i n f o   d u m p   #   D u m p   c u r r e n t   c l u s t e r   s t a t e   t o   s t d o u t   k u b e c t l   c l u s t e r - i n f o   d u m p   - - o u t p u t - d i r e c t o r y = / p a t h / t o / c l u s t e r - s t a t e   #   D u m p   c u r r e n t   c l u s t e r   s t a t e   t o   / p a t h / t o / c l u s t e r - s t a t e   #   V i e w   e x i s t i n g   t a i n t s   o n   w h i c h   e x i s t   o n   c u r r e n t   n o d e s .   k u b e c t l   g e t   n o d e s   - o = ' c u s t o m - c o l u m n s = N o d e N a m e : . m e t a d a t a . n a m e , T a i n t K e y : . s p e c . t a i n t s [ * ] . k e y , T a i n t V a l u e : . s p e c . t a i n t s [ * ] . v a l u e , T a i n t E f f e c t : . s p e c . t a i n t s [ * ] . e f f e c t '   #   I f   a   t a i n t   w i t h   t h a t   k e y   a n d   e f f e c t   a l r e a d y   e x i s t s ,   i t s   v a l u e   i s   r e p l a c e d   a s   s p e c i f i e d .   k u b e c t l   t a i n t   n o d e s   f o o   d e d i c a t e d = s p e c i a l - u s e r : N o S c h e d u l e


Question: What is Resource types?

Answer: L i s t   a l l   s u p p o r t e d   r e s o u r c e   t y p e s   a l o n g   w i t h   t h e i r   s h o r t n a m e s ,   A P I   g r o u p ,   w h e t h e r   t h e y   a r e   n a m e s p a c e d ,   a n d   k i n d :   k u b e c t l   a p i - r e s o u r c e s   O t h e r   o p e r a t i o n s   f o r   e x p l o r i n g   A P I   r e s o u r c e s :   k u b e c t l   a p i - r e s o u r c e s   - - n a m e s p a c e d = t r u e   #   A l l   n a m e s p a c e d   r e s o u r c e s   k u b e c t l   a p i - r e s o u r c e s   - - n a m e s p a c e d = f a l s e   #   A l l   n o n - n a m e s p a c e d   r e s o u r c e s   k u b e c t l   a p i - r e s o u r c e s   - o   n a m e   #   A l l   r e s o u r c e s   w i t h   s i m p l e   o u t p u t   ( o n l y   t h e   r e s o u r c e   n a m e )   k u b e c t l   a p i - r e s o u r c e s   - o   w i d e   #   A l l   r e s o u r c e s   w i t h   e x p a n d e d   ( a k a   " w i d e " )   o u t p u t   k u b e c t l   a p i - r e s o u r c e s   - - v e r b s = l i s t , g e t   #   A l l   r e s o u r c e s   t h a t   s u p p o r t   t h e   " l i s t "   a n d   " g e t "   r e q u e s t   v e r b s   k u b e c t l   a p i - r e s o u r c e s   - - a p i - g r o u p = e x t e n s i o n s   #   A l l   r e s o u r c e s   i n   t h e   " e x t e n s i o n s "   A P I   g r o u p


Question: What is Formatting output?

Answer: T o   o u t p u t   d e t a i l s   t o   y o u r   t e r m i n a l   w i n d o w   i n   a   s p e c i f i c   f o r m a t ,   a d d   t h e   - o   ( o r   - - o u t p u t )   f l a g   t o   a   s u p p o r t e d   k u b e c t l   c o m m a n d .   E x a m p l e s   u s i n g   - o = c u s t o m - c o l u m n s :   #   A l l   i m a g e s   r u n n i n g   i n   a   c l u s t e r   k u b e c t l   g e t   p o d s   - A   - o = c u s t o m - c o l u m n s = ' D A T A : s p e c . c o n t a i n e r s [ * ] . i m a g e '   #   A l l   i m a g e s   r u n n i n g   i n   n a m e s p a c e :   d e f a u l t ,   g r o u p e d   b y   P o d   k u b e c t l   g e t   p o d s   - - n a m e s p a c e   d e f a u l t   - - o u t p u t = c u s t o m - c o l u m n s = " N A M E : . m e t a d a t a . n a m e , I M A G E : . s p e c . c o n t a i n e r s [ * ] . i m a g e "   #   A l l   i m a g e s   e x c l u d i n g   " r e g i s t r y . k 8 s . i o / c o r e d n s : 1 . 6 . 2 "   k u b e c t l   g e t   p o d s   - A   - o = c u s t o m - c o l u m n s = ' D A T A : s p e c . c o n t a i n e r s [ ? ( @ . i m a g e ! = " r e g i s t r y . k 8 s . i o / c o r e d n s : 1 . 6 . 2 " ) ] . i m a g e '   #   A l l   f i e l d s   u n d e r   m e t a d a t a   r e g a r d l e s s   o f   n a m e   k u b e c t l   g e t   p o d s   - A   - o = c u s t o m - c o l u m n s = ' D A T A : m e t a d a t a . * '   M o r e   e x a m p l e s   i n   t h e   k u b e c t l   r e f e r e n c e   d o c u m e n t a t i o n .


Question: What is Kubectl output verbosity and debugging?

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


Question: What is What's next?

Answer: R e a d   t h e   k u b e c t l   o v e r v i e w   a n d   l e a r n   a b o u t   J s o n P a t h . S e e   k u b e c t l   o p t i o n s . S e e   k u b e r c   o p t i o n s . A l s o   r e a d   k u b e c t l   U s a g e   C o n v e n t i o n s   t o   u n d e r s t a n d   h o w   t o   u s e   k u b e c t l   i n   r e u s a b l e   s c r i p t s . S e e   m o r e   c o m m u n i t y   k u b e c t l   c h e a t s h e e t s .   R e a d   t h e   k u b e c t l   o v e r v i e w   a n d   l e a r n   a b o u t   J s o n P a t h .   S e e   k u b e c t l   o p t i o n s .   S e e   k u b e r c   o p t i o n s .   A l s o   r e a d   k u b e c t l   U s a g e   C o n v e n t i o n s   t o   u n d e r s t a n d   h o w   t o   u s e   k u b e c t l   i n   r e u s a b l e   s c r i p t s .   S e e   m o r e   c o m m u n i t y   k u b e c t l   c h e a t s h e e t s .


Question: What is EndpointSlices?

Answer: EndpointSlicesThe EndpointSlice API is the mechanism that Kubernetes uses to let your Service scale to handle large numbers of backends, and allows the cluster to update its list of healthy backends efficiently.FEATURE STATE: Kubernetes v1.21 [stable]Kubernetes' EndpointSlice API provides a way to track network endpoints within a Kubernetes cluster.EndpointSlice APIIn Kubernetes, an EndpointSlice contains references to a set of network endpoints. The control plane automatically creates EndpointSlices for any Kubernetes Service that has a selector specified. These EndpointSlices include references to all the Pods that match the Service selector. EndpointSlices group network endpoints together by unique combinations of IP family, protocol, port number, and Service name. The name of a EndpointSlice object must be a valid DNS subdomain name.As an example, here's a sample EndpointSlice object, that's owned by the example Kubernetes Service.apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-abc labels: kubernetes.io/service-name: example addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - "10.1.2.3" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to a maximum of 1000.EndpointSlices act as the source of truth for kube-proxy when it comes to how to route internal traffic.Address typesEndpointSlices support two address types:IPv4IPv6Each EndpointSlice object represents a specific IP address type. If you have a Service that is available via IPv4 and IPv6, there will be at least two EndpointSlice objects (one for IPv4, and one for IPv6).ConditionsThe EndpointSlice API stores conditions about endpoints that may be useful for consumers. The three conditions are serving, terminating, and ready.ServingFEATURE STATE: Kubernetes v1.26 [stable]The serving condition indicates that the endpoint is currently serving responses, and so it should be used as a target for Service traffic. For endpoints backed by a Pod, this maps to the Pod's Ready condition.TerminatingFEATURE STATE: Kubernetes v1.26 [stable]The terminating condition indicates that the endpoint is terminating. For endpoints backed by a Pod, this condition is set when the Pod is first deleted (that is, when it receives a deletion timestamp, but most likely before the Pod's containers exit).Service proxies will normally ignore endpoints that are terminating, but they may route traffic to endpoints that are both serving and terminating if all available endpoints are terminating. (This helps to ensure that no Service traffic is lost during rolling updates of the underlying Pods.)ReadyThe ready condition is essentially a shortcut for checking "serving and not terminating" (though it will also always be true for Services with spec.pub


Question: How does EndpointSlices work?

Answer: EndpointSlicesThe EndpointSlice API is the mechanism that Kubernetes uses to let your Service scale to handle large numbers of backends, and allows the cluster to update its list of healthy backends efficiently.FEATURE STATE: Kubernetes v1.21 [stable]Kubernetes' EndpointSlice API provides a way to track network endpoints within a Kubernetes cluster.EndpointSlice APIIn Kubernetes, an EndpointSlice contains references to a set of network endpoints. The control plane automatically creates EndpointSlices for any Kubernetes Service that has a selector specified. These EndpointSlices include references to all the Pods that match the Service selector. EndpointSlices group network endpoints together by unique combinations of IP family, protocol, port number, and Service name. The name of a EndpointSlice object must be a valid DNS subdomain name.As an example, here's a sample EndpointSlice object, that's owned by the example Kubernetes Service.apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-abc labels: kubernetes.io/service-name: example addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - "10.1.2.3" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to a maximum of 1000.EndpointSlices act as the source of truth for kube-proxy when it comes to how to route internal traffic.Address typesEndpointSlices support two address types:IPv4IPv6Each EndpointSlice object represents a specific IP address type. If you have a Service that is available via IPv4 and IPv6, there will be at least two EndpointSlice objects (one for IPv4, and one for IPv6).ConditionsThe EndpointSlice API stores conditions about endpoints that may be useful for consumers. The three conditions are serving, terminating, and ready.ServingFEATURE STATE: Kubernetes v1.26 [stable]The serving condition indicates that the endpoint is currently serving responses, and so it should be used as a target for Service traffic. For endpoints backed by a Pod, this maps to the Pod's Ready condition.TerminatingFEATURE STATE: Kubernetes v1.26 [stable]The terminating condition indicates that the endpoint is terminating. For endpoints backed by a Pod, this condition is set when the Pod is first deleted (that is, when it receives a deletion timestamp, but most likely before the Pod's containers exit).Service proxies will normally ignore endpoints that are terminating, but they may route traffic to endpoints that are both serving and terminating if all available endpoints are terminating. (This helps to ensure that no Service traffic is lost during rolling updates of the underlying Pods.)ReadyThe ready condition is essentially a shortcut for checking "serving and not terminating" (though it will also always be true for Services with spec.pub


Question: When would you use EndpointSlices?

Answer: EndpointSlicesThe EndpointSlice API is the mechanism that Kubernetes uses to let your Service scale to handle large numbers of backends, and allows the cluster to update its list of healthy backends efficiently.FEATURE STATE: Kubernetes v1.21 [stable]Kubernetes' EndpointSlice API provides a way to track network endpoints within a Kubernetes cluster.EndpointSlice APIIn Kubernetes, an EndpointSlice contains references to a set of network endpoints. The control plane automatically creates EndpointSlices for any Kubernetes Service that has a selector specified. These EndpointSlices include references to all the Pods that match the Service selector. EndpointSlices group network endpoints together by unique combinations of IP family, protocol, port number, and Service name. The name of a EndpointSlice object must be a valid DNS subdomain name.As an example, here's a sample EndpointSlice object, that's owned by the example Kubernetes Service.apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-abc labels: kubernetes.io/service-name: example addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - "10.1.2.3" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to a maximum of 1000.EndpointSlices act as the source of truth for kube-proxy when it comes to how to route internal traffic.Address typesEndpointSlices support two address types:IPv4IPv6Each EndpointSlice object represents a specific IP address type. If you have a Service that is available via IPv4 and IPv6, there will be at least two EndpointSlice objects (one for IPv4, and one for IPv6).ConditionsThe EndpointSlice API stores conditions about endpoints that may be useful for consumers. The three conditions are serving, terminating, and ready.ServingFEATURE STATE: Kubernetes v1.26 [stable]The serving condition indicates that the endpoint is currently serving responses, and so it should be used as a target for Service traffic. For endpoints backed by a Pod, this maps to the Pod's Ready condition.TerminatingFEATURE STATE: Kubernetes v1.26 [stable]The terminating condition indicates that the endpoint is terminating. For endpoints backed by a Pod, this condition is set when the Pod is first deleted (that is, when it receives a deletion timestamp, but most likely before the Pod's containers exit).Service proxies will normally ignore endpoints that are terminating, but they may route traffic to endpoints that are both serving and terminating if all available endpoints are terminating. (This helps to ensure that no Service traffic is lost during rolling updates of the underlying Pods.)ReadyThe ready condition is essentially a shortcut for checking "serving and not terminating" (though it will also always be true for Services with spec.pub


Question: What are the benefits of EndpointSlices?

Answer: EndpointSlicesThe EndpointSlice API is the mechanism that Kubernetes uses to let your Service scale to handle large numbers of backends, and allows the cluster to update its list of healthy backends efficiently.FEATURE STATE: Kubernetes v1.21 [stable]Kubernetes' EndpointSlice API provides a way to track network endpoints within a Kubernetes cluster.EndpointSlice APIIn Kubernetes, an EndpointSlice contains references to a set of network endpoints. The control plane automatically creates EndpointSlices for any Kubernetes Service that has a selector specified. These EndpointSlices include references to all the Pods that match the Service selector. EndpointSlices group network endpoints together by unique combinations of IP family, protocol, port number, and Service name. The name of a EndpointSlice object must be a valid DNS subdomain name.As an example, here's a sample EndpointSlice object, that's owned by the example Kubernetes Service.apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: example-abc labels: kubernetes.io/service-name: example addressType: IPv4 ports: - name: http protocol: TCP port: 80 endpoints: - addresses: - "10.1.2.3" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a By default, the control plane creates and manages EndpointSlices to have no more than 100 endpoints each. You can configure this with the --max-endpoints-per-slice kube-controller-manager flag, up to a maximum of 1000.EndpointSlices act as the source of truth for kube-proxy when it comes to how to route internal traffic.Address typesEndpointSlices support two address types:IPv4IPv6Each EndpointSlice object represents a specific IP address type. If you have a Service that is available via IPv4 and IPv6, there will be at least two EndpointSlice objects (one for IPv4, and one for IPv6).ConditionsThe EndpointSlice API stores conditions about endpoints that may be useful for consumers. The three conditions are serving, terminating, and ready.ServingFEATURE STATE: Kubernetes v1.26 [stable]The serving condition indicates that the endpoint is currently serving responses, and so it should be used as a target for Service traffic. For endpoints backed by a Pod, this maps to the Pod's Ready condition.TerminatingFEATURE STATE: Kubernetes v1.26 [stable]The terminating condition indicates that the endpoint is terminating. For endpoints backed by a Pod, this condition is set when the Pod is first deleted (that is, when it receives a deletion timestamp, but most likely before the Pod's containers exit).Service proxies will normally ignore endpoints that are terminating, but they may route traffic to endpoints that are both serving and terminating if all available endpoints are terminating. (This helps to ensure that no Service traffic is lost during rolling updates of the underlying Pods.)ReadyThe ready condition is essentially a shortcut for checking "serving and not terminating" (though it will also always be true for Services with spec.pub


Question: What is EndpointSlices?

Answer: K u b e r n e t e s '   E n d p o i n t S l i c e   A P I   p r o v i d e s   a   w a y   t o   t r a c k   n e t w o r k   e n d p o i n t s   w i t h i n   a   K u b e r n e t e s   c l u s t e r .


Question: What is EndpointSlice API?

Answer: I n   K u b e r n e t e s ,   a n   E n d p o i n t S l i c e   c o n t a i n s   r e f e r e n c e s   t o   a   s e t   o f   n e t w o r k   e n d p o i n t s .   T h e   c o n t r o l   p l a n e   a u t o m a t i c a l l y   c r e a t e s   E n d p o i n t S l i c e s   f o r   a n y   K u b e r n e t e s   S e r v i c e   t h a t   h a s   a   s e l e c t o r   s p e c i f i e d .   T h e s e   E n d p o i n t S l i c e s   i n c l u d e   r e f e r e n c e s   t o   a l l   t h e   P o d s   t h a t   m a t c h   t h e   S e r v i c e   s e l e c t o r .   E n d p o i n t S l i c e s   g r o u p   n e t w o r k   e n d p o i n t s   t o g e t h e r   b y   u n i q u e   c o m b i n a t i o n s   o f   I P   f a m i l y ,   p r o t o c o l ,   p o r t   n u m b e r ,   a n d   S e r v i c e   n a m e .   T h e   n a m e   o f   a   E n d p o i n t S l i c e   o b j e c t   m u s t   b e   a   v a l i d   D N S   s u b d o m a i n   n a m e .   A s   a n   e x a m p l e ,   h e r e ' s   a   s a m p l e   E n d p o i n t S l i c e   o b j e c t ,   t h a t ' s   o w n e d   b y   t h e   e x a m p l e   K u b e r n e t e s   S e r v i c e .   a p i V e r s i o n :   d i s c o v e r y . k 8 s . i o / v 1   k i n d :   E n d p o i n t S l i c e   m e t a d a t a :   n a m e :   e x a m p l e - a b c   l a b e l s :   k u b e r n e t e s . i o / s e r v i c e - n a m e :   e x a m p l e   a d d r e s s T y p e :   I P v 4   p o r t s :   -   n a m e :   h t t p   p r o t o c o l :   T C P   p o r t :   8 0   e n d p o i n t s :   -   a d d r e s s e s :   -   " 1 0 . 1 . 2 . 3 "   c o n d i t i o n s :   r e a d y :   t r u e   h o s t n a m e :   p o d - 1   n o d e N a m e :   n o d e - 1   z o n e :   u s - w e s t 2 - a   B y   d e f a u l t ,   t h e   c o n t r o l   p l a n e   c r e a t e s   a n d   m a n a g e s   E n d p o i n t S l i c e s   t o   h a v e   n o   m o r e   t h a n   1 0 0   e n d p o i n t s   e a c h .   Y o u   c a n   c o n f i g u


Question: What is Address types?

Answer: E n d p o i n t S l i c e s   s u p p o r t   t w o   a d d r e s s   t y p e s :   I P v 4 I P v 6   E a c h   E n d p o i n t S l i c e   o b j e c t   r e p r e s e n t s   a   s p e c i f i c   I P   a d d r e s s   t y p e .   I f   y o u   h a v e   a   S e r v i c e   t h a t   i s   a v a i l a b l e   v i a   I P v 4   a n d   I P v 6 ,   t h e r e   w i l l   b e   a t   l e a s t   t w o   E n d p o i n t S l i c e   o b j e c t s   ( o n e   f o r   I P v 4 ,   a n d   o n e   f o r   I P v 6 ) .


Question: What is Conditions?

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


Question: What is Serving?

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


Question: What is Terminating?

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


Question: What is Ready?

Answer: T h e   r e a d y   c o n d i t i o n   i s   e s s e n t i a l l y   a   s h o r t c u t   f o r   c h e c k i n g   " s e r v i n g   a n d   n o t   t e r m i n a t i n g "   ( t h o u g h   i t   w i l l   a l s o   a l w a y s   b e   t r u e   f o r   S e r v i c e s   w i t h   s p e c . p u b l i s h N o t R e a d y A d d r e s s e s   s e t   t o   t r u e ) .


Question: What is Topology information?

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


Question: What is Management?

Answer: M o s t   o f t e n ,   t h e   c o n t r o l   p l a n e   ( s p e c i f i c a l l y ,   t h e   e n d p o i n t   s l i c e   c o n t r o l l e r )   c r e a t e s   a n d   m a n a g e s   E n d p o i n t S l i c e   o b j e c t s .   T h e r e   a r e   a   v a r i e t y   o f   o t h e r   u s e   c a s e s   f o r   E n d p o i n t S l i c e s ,   s u c h   a s   s e r v i c e   m e s h   i m p l e m e n t a t i o n s ,   t h a t   c o u l d   r e s u l t   i n   o t h e r   e n t i t i e s   o r   c o n t r o l l e r s   m a n a g i n g   a d d i t i o n a l   s e t s   o f   E n d p o i n t S l i c e s .   T o   e n s u r e   t h a t   m u l t i p l e   e n t i t i e s   c a n   m a n a g e   E n d p o i n t S l i c e s   w i t h o u t   i n t e r f e r i n g   w i t h   e a c h   o t h e r ,   K u b e r n e t e s   d e f i n e s   t h e   l a b e l   e n d p o i n t s l i c e . k u b e r n e t e s . i o / m a n a g e d - b y ,   w h i c h   i n d i c a t e s   t h e   e n t i t y   m a n a g i n g   a n   E n d p o i n t S l i c e .   T h e   e n d p o i n t   s l i c e   c o n t r o l l e r   s e t s   e n d p o i n t s l i c e - c o n t r o l l e r . k 8 s . i o   a s   t h e   v a l u e   f o r   t h i s   l a b e l   o n   a l l   E n d p o i n t S l i c e s   i t   m a n a g e s .   O t h e r   e n t i t i e s   m a n a g i n g   E n d p o i n t S l i c e s   s h o u l d   a l s o   s e t   a   u n i q u e   v a l u e   f o r   t h i s   l a b e l .


Question: What is Ownership?

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


Question: What is Distribution of EndpointSlices?

Answer: E a c h   E n d p o i n t S l i c e   h a s   a   s e t   o f   p o r t s   t h a t   a p p l i e s   t o   a l l   e n d p o i n t s   w i t h i n   t h e   r e s o u r c e .   W h e n   n a m e d   p o r t s   a r e   u s e d   f o r   a   S e r v i c e ,   P o d s   m a y   e n d   u p   w i t h   d i f f e r e n t   t a r g e t   p o r t   n u m b e r s   f o r   t h e   s a m e   n a m e d   p o r t ,   r e q u i r i n g   d i f f e r e n t   E n d p o i n t S l i c e s .   T h e   c o n t r o l   p l a n e   t r i e s   t o   f i l l   E n d p o i n t S l i c e s   a s   f u l l   a s   p o s s i b l e ,   b u t   d o e s   n o t   a c t i v e l y   r e b a l a n c e   t h e m .   T h e   l o g i c   i s   f a i r l y   s t r a i g h t f o r w a r d :   I t e r a t e   t h r o u g h   e x i s t i n g   E n d p o i n t S l i c e s ,   r e m o v e   e n d p o i n t s   t h a t   a r e   n o   l o n g e r   d e s i r e d   a n d   u p d a t e   m a t c h i n g   e n d p o i n t s   t h a t   h a v e   c h a n g e d . I t e r a t e   t h r o u g h   E n d p o i n t S l i c e s   t h a t   h a v e   b e e n   m o d i f i e d   i n   t h e   f i r s t   s t e p   a n d   f i l l   t h e m   u p   w i t h   a n y   n e w   e n d p o i n t s   n e e d e d . I f   t h e r e ' s   s t i l l   n e w   e n d p o i n t s   l e f t   t o   a d d ,   t r y   t o   f i t   t h e m   i n t o   a   p r e v i o u s l y   u n c h a n g e d   s l i c e   a n d / o r   c r e a t e   n e w   o n e s .   I m p o r t a n t l y ,   t h e   t h i r d   s t e p   p r i o r i t i z e s   l i m i t i n g   E n d p o i n t S l i c e   u p d a t e s   o v e r   a   p e r f e c t l y   f u l l   d i s t r i b u t i o n   o f   E n d p o i n t S l i c e s .   A s   a n   e x a m p l e ,   i f   t h e r e   a r e   1 0   n e w   e n d p o i n t s   t o   a d d   a n d   2   E n d p o i n t S l i c e s   w i t h   r o o m   f o r   5   m o r e   e n d p o i n t s   e a c h ,   t h i s   a p p r


Question: What is Duplicate endpoints?

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


Question: What is Note:?

Answer: C l i e n t s   o f   t h e   E n d p o i n t S l i c e   A P I   m u s t   i t e r a t e   t h r o u g h   a l l   t h e   e x i s t i n g   E n d p o i n t S l i c e s   a s s o c i a t e d   t o   a   S e r v i c e   a n d   b u i l d   a   c o m p l e t e   l i s t   o f   u n i q u e   n e t w o r k   e n d p o i n t s .   I t   i s   i m p o r t a n t   t o   m e n t i o n   t h a t   e n d p o i n t s   m a y   b e   d u p l i c a t e d   i n   d i f f e r e n t   E n d p o i n t S l i c e s .   Y o u   c a n   f i n d   a   r e f e r e n c e   i m p l e m e n t a t i o n   f o r   h o w   t o   p e r f o r m   t h i s   e n d p o i n t   a g g r e g a t i o n   a n d   d e d u p l i c a t i o n   a s   p a r t   o f   t h e   E n d p o i n t S l i c e C a c h e   c o d e   w i t h i n   k u b e - p r o x y .


Question: What is EndpointSlice mirroring?

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


Question: What is What's next?

Answer: 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 R e a d   t h e   A P I   r e f e r e n c e   f o r   t h e   E n d p o i n t S l i c e   A P I R e a d   t h e   A P I   r e f e r e n c e   f o r   t h e   E n d p o i n t s   A P I


Question: What is Scheduling Policies?

Answer: Scheduling PoliciesIn Kubernetes versions before v1.23, a scheduling policy can be used to specify the predicates and priorities process. For example, you can set a scheduling policy by running kube-scheduler --policy-config-file <filename> or kube-scheduler --policy-configmap <ConfigMap>.This scheduling policy is not supported since Kubernetes v1.23. Associated flags policy-config-file, policy-configmap, policy-configmap-namespace and use-legacy-policy-config are also not supported. Instead, use the Scheduler Configuration to achieve similar behavior.What's nextLearn about schedulingLearn about kube-scheduler ConfigurationRead the kube-scheduler configuration reference (v1)


Question: How does Scheduling Policies work?

Answer: Scheduling PoliciesIn Kubernetes versions before v1.23, a scheduling policy can be used to specify the predicates and priorities process. For example, you can set a scheduling policy by running kube-scheduler --policy-config-file <filename> or kube-scheduler --policy-configmap <ConfigMap>.This scheduling policy is not supported since Kubernetes v1.23. Associated flags policy-config-file, policy-configmap, policy-configmap-namespace and use-legacy-policy-config are also not supported. Instead, use the Scheduler Configuration to achieve similar behavior.What's nextLearn about schedulingLearn about kube-scheduler ConfigurationRead the kube-scheduler configuration reference (v1)


Question: When would you use Scheduling Policies?

Answer: Scheduling PoliciesIn Kubernetes versions before v1.23, a scheduling policy can be used to specify the predicates and priorities process. For example, you can set a scheduling policy by running kube-scheduler --policy-config-file <filename> or kube-scheduler --policy-configmap <ConfigMap>.This scheduling policy is not supported since Kubernetes v1.23. Associated flags policy-config-file, policy-configmap, policy-configmap-namespace and use-legacy-policy-config are also not supported. Instead, use the Scheduler Configuration to achieve similar behavior.What's nextLearn about schedulingLearn about kube-scheduler ConfigurationRead the kube-scheduler configuration reference (v1)


Question: What are the benefits of Scheduling Policies?

Answer: Scheduling PoliciesIn Kubernetes versions before v1.23, a scheduling policy can be used to specify the predicates and priorities process. For example, you can set a scheduling policy by running kube-scheduler --policy-config-file <filename> or kube-scheduler --policy-configmap <ConfigMap>.This scheduling policy is not supported since Kubernetes v1.23. Associated flags policy-config-file, policy-configmap, policy-configmap-namespace and use-legacy-policy-config are also not supported. Instead, use the Scheduler Configuration to achieve similar behavior.What's nextLearn about schedulingLearn about kube-scheduler ConfigurationRead the kube-scheduler configuration reference (v1)


Question: What is Scheduling Policies?

Answer: I n   K u b e r n e t e s   v e r s i o n s   b e f o r e   v 1 . 2 3 ,   a   s c h e d u l i n g   p o l i c y   c a n   b e   u s e d   t o   s p e c i f y   t h e   p r e d i c a t e s   a n d   p r i o r i t i e s   p r o c e s s .   F o r   e x a m p l e ,   y o u   c a n   s e t   a   s c h e d u l i n g   p o l i c y   b y   r u n n i n g   k u b e - s c h e d u l e r   - - p o l i c y - c o n f i g - f i l e   < f i l e n a m e >   o r   k u b e - s c h e d u l e r   - - p o l i c y - c o n f i g m a p   < C o n f i g M a p > .   T h i s   s c h e d u l i n g   p o l i c y   i s   n o t   s u p p o r t e d   s i n c e   K u b e r n e t e s   v 1 . 2 3 .   A s s o c i a t e d   f l a g s   p o l i c y - c o n f i g - f i l e ,   p o l i c y - c o n f i g m a p ,   p o l i c y - c o n f i g m a p - n a m e s p a c e   a n d   u s e - l e g a c y - p o l i c y - c o n f i g   a r e   a l s o   n o t   s u p p o r t e d .   I n s t e a d ,   u s e   t h e   S c h e d u l e r   C o n f i g u r a t i o n   t o   a c h i e v e   s i m i l a r   b e h a v i o r .


Question: What is What's next?

Answer: L e a r n   a b o u t   s c h e d u l i n g L e a r n   a b o u t   k u b e - s c h e d u l e r   C o n f i g u r a t i o n R e a d   t h e   k u b e - s c h e d u l e r   c o n f i g u r a t i o n   r e f e r e n c e   ( v 1 )


Question: What is System Logs?

Answer: System LogsSystem component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing errors within a component, or as fine-grained as showing step-by-step traces of events (like HTTP access logs, pod state changes, controller actions, or scheduler decisions).Warning:In contrast to the command line flags described here, the log output itself does not fall under the Kubernetes API stability guarantees: individual log entries and their formatting may change from one release to the next!Klogklog is the Kubernetes logging library. klog generates log messages for the Kubernetes system components.Kubernetes is in the process of simplifying logging in its components. The following klog command line flags are deprecated starting with Kubernetes v1.23 and removed in Kubernetes v1.26:--add-dir-header--alsologtostderr--log-backtrace-at--log-dir--log-file--log-file-max-size--logtostderr--one-output--skip-headers--skip-log-headers--stderrthresholdOutput will always be written to stderr, regardless of the output format. Output redirection is expected to be handled by the component which invokes a Kubernetes component. This can be a POSIX shell or a tool like systemd.In some cases, for example a distroless container or a Windows system service, those options are not available. Then the kube-log-runner binary can be used as wrapper around a Kubernetes component to redirect output. A prebuilt binary is included in several Kubernetes base images under its traditional name as /go-runner and as kube-log-runner in server and node release archives.This table shows how kube-log-runner invocations correspond to shell redirection:UsagePOSIX shell (such as bash)kube-log-runner <options> <cmd>Merge stderr and stdout, write to stdout2>&1kube-log-runner (default behavior)Redirect both into log file1>>/tmp/log 2>&1kube-log-runner -log-file=/tmp/logCopy into log file and to stdout2>&1 | tee -a /tmp/logkube-log-runner -log-file=/tmp/log -also-stdoutRedirect only stdout into log file>/tmp/logkube-log-runner -log-file=/tmp/log -redirect-stderr=falseKlog outputAn example of the traditional klog native format:I1025 00:15:15.525108 1 httplog.go:79] GET /api/v1/namespaces/kube-system/pods/metrics-server-v0.3.1-57c75779f-9p8wg: (1.512ms) 200 [pod_nanny/v0.0.0 (linux/amd64) kubernetes/$Format 10.56.1.19:51756] The message string may contain line breaks:I1025 00:15:15.525108 1 example.go:79] This is a message which has a line break. Structured LoggingFEATURE STATE: Kubernetes v1.23 [beta]Warning:Migration to structured log messages is an ongoing process. Not all log messages are structured in this version. When parsing log files, you must also handle unstructured log messages.Log formatting and value serialization are subject to change.Structured logging introduces a uniform structure in log messages allowing for programmatic extraction of information. You can stor


Question: How does System Logs work?

Answer: System LogsSystem component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing errors within a component, or as fine-grained as showing step-by-step traces of events (like HTTP access logs, pod state changes, controller actions, or scheduler decisions).Warning:In contrast to the command line flags described here, the log output itself does not fall under the Kubernetes API stability guarantees: individual log entries and their formatting may change from one release to the next!Klogklog is the Kubernetes logging library. klog generates log messages for the Kubernetes system components.Kubernetes is in the process of simplifying logging in its components. The following klog command line flags are deprecated starting with Kubernetes v1.23 and removed in Kubernetes v1.26:--add-dir-header--alsologtostderr--log-backtrace-at--log-dir--log-file--log-file-max-size--logtostderr--one-output--skip-headers--skip-log-headers--stderrthresholdOutput will always be written to stderr, regardless of the output format. Output redirection is expected to be handled by the component which invokes a Kubernetes component. This can be a POSIX shell or a tool like systemd.In some cases, for example a distroless container or a Windows system service, those options are not available. Then the kube-log-runner binary can be used as wrapper around a Kubernetes component to redirect output. A prebuilt binary is included in several Kubernetes base images under its traditional name as /go-runner and as kube-log-runner in server and node release archives.This table shows how kube-log-runner invocations correspond to shell redirection:UsagePOSIX shell (such as bash)kube-log-runner <options> <cmd>Merge stderr and stdout, write to stdout2>&1kube-log-runner (default behavior)Redirect both into log file1>>/tmp/log 2>&1kube-log-runner -log-file=/tmp/logCopy into log file and to stdout2>&1 | tee -a /tmp/logkube-log-runner -log-file=/tmp/log -also-stdoutRedirect only stdout into log file>/tmp/logkube-log-runner -log-file=/tmp/log -redirect-stderr=falseKlog outputAn example of the traditional klog native format:I1025 00:15:15.525108 1 httplog.go:79] GET /api/v1/namespaces/kube-system/pods/metrics-server-v0.3.1-57c75779f-9p8wg: (1.512ms) 200 [pod_nanny/v0.0.0 (linux/amd64) kubernetes/$Format 10.56.1.19:51756] The message string may contain line breaks:I1025 00:15:15.525108 1 example.go:79] This is a message which has a line break. Structured LoggingFEATURE STATE: Kubernetes v1.23 [beta]Warning:Migration to structured log messages is an ongoing process. Not all log messages are structured in this version. When parsing log files, you must also handle unstructured log messages.Log formatting and value serialization are subject to change.Structured logging introduces a uniform structure in log messages allowing for programmatic extraction of information. You can stor


Question: When would you use System Logs?

Answer: System LogsSystem component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing errors within a component, or as fine-grained as showing step-by-step traces of events (like HTTP access logs, pod state changes, controller actions, or scheduler decisions).Warning:In contrast to the command line flags described here, the log output itself does not fall under the Kubernetes API stability guarantees: individual log entries and their formatting may change from one release to the next!Klogklog is the Kubernetes logging library. klog generates log messages for the Kubernetes system components.Kubernetes is in the process of simplifying logging in its components. The following klog command line flags are deprecated starting with Kubernetes v1.23 and removed in Kubernetes v1.26:--add-dir-header--alsologtostderr--log-backtrace-at--log-dir--log-file--log-file-max-size--logtostderr--one-output--skip-headers--skip-log-headers--stderrthresholdOutput will always be written to stderr, regardless of the output format. Output redirection is expected to be handled by the component which invokes a Kubernetes component. This can be a POSIX shell or a tool like systemd.In some cases, for example a distroless container or a Windows system service, those options are not available. Then the kube-log-runner binary can be used as wrapper around a Kubernetes component to redirect output. A prebuilt binary is included in several Kubernetes base images under its traditional name as /go-runner and as kube-log-runner in server and node release archives.This table shows how kube-log-runner invocations correspond to shell redirection:UsagePOSIX shell (such as bash)kube-log-runner <options> <cmd>Merge stderr and stdout, write to stdout2>&1kube-log-runner (default behavior)Redirect both into log file1>>/tmp/log 2>&1kube-log-runner -log-file=/tmp/logCopy into log file and to stdout2>&1 | tee -a /tmp/logkube-log-runner -log-file=/tmp/log -also-stdoutRedirect only stdout into log file>/tmp/logkube-log-runner -log-file=/tmp/log -redirect-stderr=falseKlog outputAn example of the traditional klog native format:I1025 00:15:15.525108 1 httplog.go:79] GET /api/v1/namespaces/kube-system/pods/metrics-server-v0.3.1-57c75779f-9p8wg: (1.512ms) 200 [pod_nanny/v0.0.0 (linux/amd64) kubernetes/$Format 10.56.1.19:51756] The message string may contain line breaks:I1025 00:15:15.525108 1 example.go:79] This is a message which has a line break. Structured LoggingFEATURE STATE: Kubernetes v1.23 [beta]Warning:Migration to structured log messages is an ongoing process. Not all log messages are structured in this version. When parsing log files, you must also handle unstructured log messages.Log formatting and value serialization are subject to change.Structured logging introduces a uniform structure in log messages allowing for programmatic extraction of information. You can stor


Question: What are the benefits of System Logs?

Answer: System LogsSystem component logs record events happening in cluster, which can be very useful for debugging. You can configure log verbosity to see more or less detail. Logs can be as coarse-grained as showing errors within a component, or as fine-grained as showing step-by-step traces of events (like HTTP access logs, pod state changes, controller actions, or scheduler decisions).Warning:In contrast to the command line flags described here, the log output itself does not fall under the Kubernetes API stability guarantees: individual log entries and their formatting may change from one release to the next!Klogklog is the Kubernetes logging library. klog generates log messages for the Kubernetes system components.Kubernetes is in the process of simplifying logging in its components. The following klog command line flags are deprecated starting with Kubernetes v1.23 and removed in Kubernetes v1.26:--add-dir-header--alsologtostderr--log-backtrace-at--log-dir--log-file--log-file-max-size--logtostderr--one-output--skip-headers--skip-log-headers--stderrthresholdOutput will always be written to stderr, regardless of the output format. Output redirection is expected to be handled by the component which invokes a Kubernetes component. This can be a POSIX shell or a tool like systemd.In some cases, for example a distroless container or a Windows system service, those options are not available. Then the kube-log-runner binary can be used as wrapper around a Kubernetes component to redirect output. A prebuilt binary is included in several Kubernetes base images under its traditional name as /go-runner and as kube-log-runner in server and node release archives.This table shows how kube-log-runner invocations correspond to shell redirection:UsagePOSIX shell (such as bash)kube-log-runner <options> <cmd>Merge stderr and stdout, write to stdout2>&1kube-log-runner (default behavior)Redirect both into log file1>>/tmp/log 2>&1kube-log-runner -log-file=/tmp/logCopy into log file and to stdout2>&1 | tee -a /tmp/logkube-log-runner -log-file=/tmp/log -also-stdoutRedirect only stdout into log file>/tmp/logkube-log-runner -log-file=/tmp/log -redirect-stderr=falseKlog outputAn example of the traditional klog native format:I1025 00:15:15.525108 1 httplog.go:79] GET /api/v1/namespaces/kube-system/pods/metrics-server-v0.3.1-57c75779f-9p8wg: (1.512ms) 200 [pod_nanny/v0.0.0 (linux/amd64) kubernetes/$Format 10.56.1.19:51756] The message string may contain line breaks:I1025 00:15:15.525108 1 example.go:79] This is a message which has a line break. Structured LoggingFEATURE STATE: Kubernetes v1.23 [beta]Warning:Migration to structured log messages is an ongoing process. Not all log messages are structured in this version. When parsing log files, you must also handle unstructured log messages.Log formatting and value serialization are subject to change.Structured logging introduces a uniform structure in log messages allowing for programmatic extraction of information. You can stor


Question: What is System Logs?

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


Question: What is Klog?

Answer: k l o g   i s   t h e   K u b e r n e t e s   l o g g i n g   l i b r a r y .   k l o g   g e n e r a t e s   l o g   m e s s a g e s   f o r   t h e   K u b e r n e t e s   s y s t e m   c o m p o n e n t s .   K u b e r n e t e s   i s   i n   t h e   p r o c e s s   o f   s i m p l i f y i n g   l o g g i n g   i n   i t s   c o m p o n e n t s .   T h e   f o l l o w i n g   k l o g   c o m m a n d   l i n e   f l a g s   a r e   d e p r e c a t e d   s t a r t i n g   w i t h   K u b e r n e t e s   v 1 . 2 3   a n d   r e m o v e d   i n   K u b e r n e t e s   v 1 . 2 6 :   - - a d d - d i r - h e a d e r - - a l s o l o g t o s t d e r r - - l o g - b a c k t r a c e - a t - - l o g - d i r - - l o g - f i l e - - l o g - f i l e - m a x - s i z e - - l o g t o s t d e r r - - o n e - o u t p u t - - s k i p - h e a d e r s - - s k i p - l o g - h e a d e r s - - s t d e r r t h r e s h o l d   O u t p u t   w i l l   a l w a y s   b e   w r i t t e n   t o   s t d e r r ,   r e g a r d l e s s   o f   t h e   o u t p u t   f o r m a t .   O u t p u t   r e d i r e c t i o n   i s   e x p e c t e d   t o   b e   h a n d l e d   b y   t h e   c o m p o n e n t   w h i c h   i n v o k e s   a   K u b e r n e t e s   c o m p o n e n t .   T h i s   c a n   b e   a   P O S I X   s h e l l   o r   a   t o o l   l i k e   s y s t e m d .   I n   s o m e   c a s e s ,   f o r   e x a m p l e   a   d i s t r o l e s s   c o n t a i n e r   o r   a   W i n d o w s   s y s t e m   s e r v i c e ,   t h o s e   o p t i o n s   a r e   n o t   a v a i l a b l e .   T h e n   t h e   k u b e - l o g - r u n n e r   b i n a r y   c a n   b e   u s e d   a s   w r a p p e r   a r o u n d   a   K u b e r n e t e s   c o m p o n e n t   t o   r e d i r e c t   o u t p u t .   A   p r e b u i l t   b i n a r y   i s   i n c l u d e d   i n   s e v e r a l   K u b e r n e t e s   b a s e   i m a g e s   u n d e r   i t s   t r a d i t i o n a l   n a m e   a s   / g o - r u n


Question: What is Klog output?

Answer: A n   e x a m p l e   o f   t h e   t r a d i t i o n a l   k l o g   n a t i v e   f o r m a t :   I 1 0 2 5   0 0 : 1 5 : 1 5 . 5 2 5 1 0 8   1   h t t p l o g . g o : 7 9 ]   G E T   / a p i / v 1 / n a m e s p a c e s / k u b e - s y s t e m / p o d s / m e t r i c s - s e r v e r - v 0 . 3 . 1 - 5 7 c 7 5 7 7 9 f - 9 p 8 w g :   ( 1 . 5 1 2 m s )   2 0 0   [ p o d _ n a n n y / v 0 . 0 . 0   ( l i n u x / a m d 6 4 )   k u b e r n e t e s / $ F o r m a t   1 0 . 5 6 . 1 . 1 9 : 5 1 7 5 6 ]   T h e   m e s s a g e   s t r i n g   m a y   c o n t a i n   l i n e   b r e a k s :   I 1 0 2 5   0 0 : 1 5 : 1 5 . 5 2 5 1 0 8   1   e x a m p l e . g o : 7 9 ]   T h i s   i s   a   m e s s a g e   w h i c h   h a s   a   l i n e   b r e a k .


Question: What is Warning:?

Answer: M i g r a t i o n   t o   s t r u c t u r e d   l o g   m e s s a g e s   i s   a n   o n g o i n g   p r o c e s s .   N o t   a l l   l o g   m e s s a g e s   a r e   s t r u c t u r e d   i n   t h i s   v e r s i o n .   W h e n   p a r s i n g   l o g   f i l e s ,   y o u   m u s t   a l s o   h a n d l e   u n s t r u c t u r e d   l o g   m e s s a g e s .   L o g   f o r m a t t i n g   a n d   v a l u e   s e r i a l i z a t i o n   a r e   s u b j e c t   t o   c h a n g e .   S t r u c t u r e d   l o g g i n g   i n t r o d u c e s   a   u n i f o r m   s t r u c t u r e   i n   l o g   m e s s a g e s   a l l o w i n g   f o r   p r o g r a m m a t i c   e x t r a c t i o n   o f   i n f o r m a t i o n .   Y o u   c a n   s t o r e   a n d   p r o c e s s   s t r u c t u r e d   l o g s   w i t h   l e s s   e f f o r t   a n d   c o s t .   T h e   c o d e   w h i c h   g e n e r a t e s   a   l o g   m e s s a g e   d e t e r m i n e s   w h e t h e r   i t   u s e s   t h e   t r a d i t i o n a l   u n s t r u c t u r e d   k l o g   o u t p u t   o r   s t r u c t u r e d   l o g g i n g .   T h e   d e f a u l t   f o r m a t t i n g   o f   s t r u c t u r e d   l o g   m e s s a g e s   i s   a s   t e x t ,   w i t h   a   f o r m a t   t h a t   i s   b a c k w a r d   c o m p a t i b l e   w i t h   t r a d i t i o n a l   k l o g :   < k l o g   h e a d e r >   " < m e s s a g e > "   < k e y 1 > = " < v a l u e 1 > "   < k e y 2 > = " < v a l u e 2 > "   . . .   E x a m p l e :   I 1 0 2 5   0 0 : 1 5 : 1 5 . 5 2 5 1 0 8   1   c o n t r o l l e r _ u t i l s . g o : 1 1 6 ]   " P o d   s t a t u s   u p d a t e d "   p o d = " k u b e - s y s t e m / k u b e d n s "   s t a t u s = " r e a d y "   S t r i n g s   a r e   q u o t e d .   O t h e r   v a l u e s   a r e   f o r m a t t e d   w i t h   % + v ,   w h i c h   m a y   c a u s e   l o g   m e s s a g e s   t o   c o n t i n u e   o n   t h e   n e x t   l i n e   d e p e n d i


Question: What is Contextual Logging?

Answer: C o n t e x t u a l   l o g g i n g   b u i l d s   o n   t o p   o f   s t r u c t u r e d   l o g g i n g .   I t   i s   p r i m a r i l y   a b o u t   h o w   d e v e l o p e r s   u s e   l o g g i n g   c a l l s :   c o d e   b a s e d   o n   t h a t   c o n c e p t   i s   m o r e   f l e x i b l e   a n d   s u p p o r t s   a d d i t i o n a l   u s e   c a s e s   a s   d e s c r i b e d   i n   t h e   C o n t e x t u a l   L o g g i n g   K E P .   I f   d e v e l o p e r s   u s e   a d d i t i o n a l   f u n c t i o n s   l i k e   W i t h V a l u e s   o r   W i t h N a m e   i n   t h e i r   c o m p o n e n t s ,   t h e n   l o g   e n t r i e s   c o n t a i n   a d d i t i o n a l   i n f o r m a t i o n   t h a t   g e t s   p a s s e d   i n t o   f u n c t i o n s   b y   t h e i r   c a l l e r .   F o r   K u b e r n e t e s   1 . 3 4 ,   t h i s   i s   g a t e d   b e h i n d   t h e   C o n t e x t u a l L o g g i n g   f e a t u r e   g a t e   a n d   i s   e n a b l e d   b y   d e f a u l t .   T h e   i n f r a s t r u c t u r e   f o r   t h i s   w a s   a d d e d   i n   1 . 2 4   w i t h o u t   m o d i f y i n g   c o m p o n e n t s .   T h e   c o m p o n e n t - b a s e / l o g s / e x a m p l e   c o m m a n d   d e m o n s t r a t e s   h o w   t o   u s e   t h e   n e w   l o g g i n g   c a l l s   a n d   h o w   a   c o m p o n e n t   b e h a v e s   t h a t   s u p p o r t s   c o n t e x t u a l   l o g g i n g .   $   c d   $ G O P A T H / s r c / k 8 s . i o / k u b e r n e t e s / s t a g i n g / s r c / k 8 s . i o / c o m p o n e n t - b a s e / l o g s / e x a m p l e / c m d /   $   g o   r u n   .   - - h e l p   . . .   - - f e a t u r e - g a t e s   m a p S t r i n g B o o l   A   s e t   o f   k e y = v a l u e   p a i r s   t h a t   d e s c r i b e   f e a t u r e   g a t e s   f o r   a l p h a / e x p e r i m e n t a l   f e a t u r e s .   O p t i o n s   a r e :   A l l A l p h a = t r u e | f


Question: What is Warning:?

Answer: J S O N   o u t p u t   d o e s   n o t   s u p p o r t   m a n y   s t a n d a r d   k l o g   f l a g s .   F o r   l i s t   o f   u n s u p p o r t e d   k l o g   f l a g s ,   s e e   t h e   C o m m a n d   l i n e   t o o l   r e f e r e n c e .   N o t   a l l   l o g s   a r e   g u a r a n t e e d   t o   b e   w r i t t e n   i n   J S O N   f o r m a t   ( f o r   e x a m p l e ,   d u r i n g   p r o c e s s   s t a r t ) .   I f   y o u   i n t e n d   t o   p a r s e   l o g s ,   m a k e   s u r e   y o u   c a n   h a n d l e   l o g   l i n e s   t h a t   a r e   n o t   J S O N   a s   w e l l .   F i e l d   n a m e s   a n d   J S O N   s e r i a l i z a t i o n   a r e   s u b j e c t   t o   c h a n g e .   T h e   - - l o g g i n g - f o r m a t = j s o n   f l a g   c h a n g e s   t h e   f o r m a t   o f   l o g s   f r o m   k l o g   n a t i v e   f o r m a t   t o   J S O N   f o r m a t .   E x a m p l e   o f   J S O N   l o g   f o r m a t   ( p r e t t y   p r i n t e d ) :   {   " t s " :   1 5 8 0 3 0 6 7 7 7 . 0 4 7 2 8 ,   " v " :   4 ,   " m s g " :   " P o d   s t a t u s   u p d a t e d " ,   " p o d " : {   " n a m e " :   " n g i n x - 1 " ,   " n a m e s p a c e " :   " d e f a u l t "   } ,   " s t a t u s " :   " r e a d y "   }   K e y s   w i t h   s p e c i a l   m e a n i n g :   t s   -   t i m e s t a m p   a s   U n i x   t i m e   ( r e q u i r e d ,   f l o a t ) v   -   v e r b o s i t y   ( o n l y   f o r   i n f o   a n d   n o t   f o r   e r r o r   m e s s a g e s ,   i n t ) e r r   -   e r r o r   s t r i n g   ( o p t i o n a l ,   s t r i n g ) m s g   -   m e s s a g e   ( r e q u i r e d ,   s t r i n g )   L i s t   o f   c o m p o n e n t s   c u r r e n t l y   s u p p o r t i n g   J S O N   f o r m a t :   k u b e - c o n t r o l l e r - m a n a g e r k u b e - a p i s e r v e r k u b e - s c h e d u l e r k u b e l e t


Question: What is Log verbosity level?

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


Question: What is Log location?

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


Question: What is Log query?

Answer: T o   h e l p   w i t h   d e b u g g i n g   i s s u e s   o n   n o d e s ,   K u b e r n e t e s   v 1 . 2 7   i n t r o d u c e d   a   f e a t u r e   t h a t   a l l o w s   v i e w i n g   l o g s   o f   s e r v i c e s   r u n n i n g   o n   t h e   n o d e .   T o   u s e   t h e   f e a t u r e ,   e n s u r e   t h a t   t h e   N o d e L o g Q u e r y   f e a t u r e   g a t e   i s   e n a b l e d   f o r   t h a t   n o d e ,   a n d   t h a t   t h e   k u b e l e t   c o n f i g u r a t i o n   o p t i o n s   e n a b l e S y s t e m L o g H a n d l e r   a n d   e n a b l e S y s t e m L o g Q u e r y   a r e   b o t h   s e t   t o   t r u e .   O n   L i n u x   t h e   a s s u m p t i o n   i s   t h a t   s e r v i c e   l o g s   a r e   a v a i l a b l e   v i a   j o u r n a l d .   O n   W i n d o w s   t h e   a s s u m p t i o n   i s   t h a t   s e r v i c e   l o g s   a r e   a v a i l a b l e   i n   t h e   a p p l i c a t i o n   l o g   p r o v i d e r .   O n   b o t h   o p e r a t i n g   s y s t e m s ,   l o g s   a r e   a l s o   a v a i l a b l e   b y   r e a d i n g   f i l e s   w i t h i n   / v a r / l o g / .   P r o v i d e d   y o u   a r e   a u t h o r i z e d   t o   i n t e r a c t   w i t h   n o d e   o b j e c t s ,   y o u   c a n   t r y   o u t   t h i s   f e a t u r e   o n   a l l   y o u r   n o d e s   o r   j u s t   a   s u b s e t .   H e r e   i s   a n   e x a m p l e   t o   r e t r i e v e   t h e   k u b e l e t   s e r v i c e   l o g s   f r o m   a   n o d e :   #   F e t c h   k u b e l e t   l o g s   f r o m   a   n o d e   n a m e d   n o d e - 1 . e x a m p l e   k u b e c t l   g e t   - - r a w   " / a p i / v 1 / n o d e s / n o d e - 1 . e x a m p l e / p r o x y / l o g s / ? q u e r y = k u b e l e t "   Y o u   c a n   a l s o   f e t c h   f i l e s ,   p r o v i d e d   t h a t   t h e   f i l e s   a r e   i n   a   d i r e c t o r y   t h a t   t h e   k u b e l e t   a l


Question: What is What's next?

Answer: R e a d   a b o u t   t h e   K u b e r n e t e s   L o g g i n g   A r c h i t e c t u r e R e a d   a b o u t   S t r u c t u r e d   L o g g i n g R e a d   a b o u t   C o n t e x t u a l   L o g g i n g R e a d   a b o u t   d e p r e c a t i o n   o f   k l o g   f l a g s R e a d   a b o u t   t h e   C o n v e n t i o n s   f o r   l o g g i n g   s e v e r i t y R e a d   a b o u t   L o g   Q u e r y


Question: What is About cgroup v2?

Answer: About cgroup v2On Linux, control groups constrain resources that are allocated to processes.The kubelet and the underlying container runtime need to interface with cgroups to enforce resource management for pods and containers which includes cpu/memory requests and limits for containerized workloads.There are two versions of cgroups in Linux: cgroup v1 and cgroup v2. cgroup v2 is the new generation of the cgroup API.What is cgroup v2?FEATURE STATE: Kubernetes v1.25 [stable]cgroup v2 is the next version of the Linux cgroup API. cgroup v2 provides a unified control system with enhanced resource management capabilities.cgroup v2 offers several improvements over cgroup v1, such as the following:Single unified hierarchy design in APISafer sub-tree delegation to containersNewer features like Pressure Stall InformationEnhanced resource allocation management and isolation across multiple resourcesUnified accounting for different types of memory allocations (network memory, kernel memory, etc)Accounting for non-immediate resource changes such as page cache write backsSome Kubernetes features exclusively use cgroup v2 for enhanced resource management and isolation. For example, the MemoryQoS feature improves memory QoS and relies on cgroup v2 primitives.Using cgroup v2The recommended way to use cgroup v2 is to use a Linux distribution that enables and uses cgroup v2 by default.To check if your distribution uses cgroup v2, refer to Identify cgroup version on Linux nodes.Requirementscgroup v2 has the following requirements:OS distribution enables cgroup v2Linux Kernel version is 5.8 or laterContainer runtime supports cgroup v2. For example:containerd v1.4 and latercri-o v1.20 and laterThe kubelet and the container runtime are configured to use the systemd cgroup driverLinux Distribution cgroup v2 supportFor a list of Linux distributions that use cgroup v2, refer to the cgroup v2 documentationContainer Optimized OS (since M97)Ubuntu (since 21.10, 22.04+ recommended)Debian GNU/Linux (since Debian 11 bullseye)Fedora (since 31)Arch Linux (since April 2021)RHEL and RHEL-like distributions (since 9)To check if your distribution is using cgroup v2, refer to your distribution's documentation or follow the instructions in Identify the cgroup version on Linux nodes.You can also enable cgroup v2 manually on your Linux distribution by modifying the kernel cmdline boot arguments. If your distribution uses GRUB, systemd.unified_cgroup_hierarchy=1 should be added in GRUB_CMDLINE_LINUX under /etc/default/grub, followed by sudo update-grub. However, the recommended approach is to use a distribution that already enables cgroup v2 by default.Migrating to cgroup v2To migrate to cgroup v2, ensure that you meet the requirements, then upgrade to a kernel version that enables cgroup v2 by default.The kubelet automatically detects that the OS is running on cgroup v2 and performs accordingly with no additional configuration required.There should not be any noticeable difference in th


Question: How does About cgroup v2 work?

Answer: About cgroup v2On Linux, control groups constrain resources that are allocated to processes.The kubelet and the underlying container runtime need to interface with cgroups to enforce resource management for pods and containers which includes cpu/memory requests and limits for containerized workloads.There are two versions of cgroups in Linux: cgroup v1 and cgroup v2. cgroup v2 is the new generation of the cgroup API.What is cgroup v2?FEATURE STATE: Kubernetes v1.25 [stable]cgroup v2 is the next version of the Linux cgroup API. cgroup v2 provides a unified control system with enhanced resource management capabilities.cgroup v2 offers several improvements over cgroup v1, such as the following:Single unified hierarchy design in APISafer sub-tree delegation to containersNewer features like Pressure Stall InformationEnhanced resource allocation management and isolation across multiple resourcesUnified accounting for different types of memory allocations (network memory, kernel memory, etc)Accounting for non-immediate resource changes such as page cache write backsSome Kubernetes features exclusively use cgroup v2 for enhanced resource management and isolation. For example, the MemoryQoS feature improves memory QoS and relies on cgroup v2 primitives.Using cgroup v2The recommended way to use cgroup v2 is to use a Linux distribution that enables and uses cgroup v2 by default.To check if your distribution uses cgroup v2, refer to Identify cgroup version on Linux nodes.Requirementscgroup v2 has the following requirements:OS distribution enables cgroup v2Linux Kernel version is 5.8 or laterContainer runtime supports cgroup v2. For example:containerd v1.4 and latercri-o v1.20 and laterThe kubelet and the container runtime are configured to use the systemd cgroup driverLinux Distribution cgroup v2 supportFor a list of Linux distributions that use cgroup v2, refer to the cgroup v2 documentationContainer Optimized OS (since M97)Ubuntu (since 21.10, 22.04+ recommended)Debian GNU/Linux (since Debian 11 bullseye)Fedora (since 31)Arch Linux (since April 2021)RHEL and RHEL-like distributions (since 9)To check if your distribution is using cgroup v2, refer to your distribution's documentation or follow the instructions in Identify the cgroup version on Linux nodes.You can also enable cgroup v2 manually on your Linux distribution by modifying the kernel cmdline boot arguments. If your distribution uses GRUB, systemd.unified_cgroup_hierarchy=1 should be added in GRUB_CMDLINE_LINUX under /etc/default/grub, followed by sudo update-grub. However, the recommended approach is to use a distribution that already enables cgroup v2 by default.Migrating to cgroup v2To migrate to cgroup v2, ensure that you meet the requirements, then upgrade to a kernel version that enables cgroup v2 by default.The kubelet automatically detects that the OS is running on cgroup v2 and performs accordingly with no additional configuration required.There should not be any noticeable difference in th


Question: When would you use About cgroup v2?

Answer: About cgroup v2On Linux, control groups constrain resources that are allocated to processes.The kubelet and the underlying container runtime need to interface with cgroups to enforce resource management for pods and containers which includes cpu/memory requests and limits for containerized workloads.There are two versions of cgroups in Linux: cgroup v1 and cgroup v2. cgroup v2 is the new generation of the cgroup API.What is cgroup v2?FEATURE STATE: Kubernetes v1.25 [stable]cgroup v2 is the next version of the Linux cgroup API. cgroup v2 provides a unified control system with enhanced resource management capabilities.cgroup v2 offers several improvements over cgroup v1, such as the following:Single unified hierarchy design in APISafer sub-tree delegation to containersNewer features like Pressure Stall InformationEnhanced resource allocation management and isolation across multiple resourcesUnified accounting for different types of memory allocations (network memory, kernel memory, etc)Accounting for non-immediate resource changes such as page cache write backsSome Kubernetes features exclusively use cgroup v2 for enhanced resource management and isolation. For example, the MemoryQoS feature improves memory QoS and relies on cgroup v2 primitives.Using cgroup v2The recommended way to use cgroup v2 is to use a Linux distribution that enables and uses cgroup v2 by default.To check if your distribution uses cgroup v2, refer to Identify cgroup version on Linux nodes.Requirementscgroup v2 has the following requirements:OS distribution enables cgroup v2Linux Kernel version is 5.8 or laterContainer runtime supports cgroup v2. For example:containerd v1.4 and latercri-o v1.20 and laterThe kubelet and the container runtime are configured to use the systemd cgroup driverLinux Distribution cgroup v2 supportFor a list of Linux distributions that use cgroup v2, refer to the cgroup v2 documentationContainer Optimized OS (since M97)Ubuntu (since 21.10, 22.04+ recommended)Debian GNU/Linux (since Debian 11 bullseye)Fedora (since 31)Arch Linux (since April 2021)RHEL and RHEL-like distributions (since 9)To check if your distribution is using cgroup v2, refer to your distribution's documentation or follow the instructions in Identify the cgroup version on Linux nodes.You can also enable cgroup v2 manually on your Linux distribution by modifying the kernel cmdline boot arguments. If your distribution uses GRUB, systemd.unified_cgroup_hierarchy=1 should be added in GRUB_CMDLINE_LINUX under /etc/default/grub, followed by sudo update-grub. However, the recommended approach is to use a distribution that already enables cgroup v2 by default.Migrating to cgroup v2To migrate to cgroup v2, ensure that you meet the requirements, then upgrade to a kernel version that enables cgroup v2 by default.The kubelet automatically detects that the OS is running on cgroup v2 and performs accordingly with no additional configuration required.There should not be any noticeable difference in th


Question: What are the benefits of About cgroup v2?

Answer: About cgroup v2On Linux, control groups constrain resources that are allocated to processes.The kubelet and the underlying container runtime need to interface with cgroups to enforce resource management for pods and containers which includes cpu/memory requests and limits for containerized workloads.There are two versions of cgroups in Linux: cgroup v1 and cgroup v2. cgroup v2 is the new generation of the cgroup API.What is cgroup v2?FEATURE STATE: Kubernetes v1.25 [stable]cgroup v2 is the next version of the Linux cgroup API. cgroup v2 provides a unified control system with enhanced resource management capabilities.cgroup v2 offers several improvements over cgroup v1, such as the following:Single unified hierarchy design in APISafer sub-tree delegation to containersNewer features like Pressure Stall InformationEnhanced resource allocation management and isolation across multiple resourcesUnified accounting for different types of memory allocations (network memory, kernel memory, etc)Accounting for non-immediate resource changes such as page cache write backsSome Kubernetes features exclusively use cgroup v2 for enhanced resource management and isolation. For example, the MemoryQoS feature improves memory QoS and relies on cgroup v2 primitives.Using cgroup v2The recommended way to use cgroup v2 is to use a Linux distribution that enables and uses cgroup v2 by default.To check if your distribution uses cgroup v2, refer to Identify cgroup version on Linux nodes.Requirementscgroup v2 has the following requirements:OS distribution enables cgroup v2Linux Kernel version is 5.8 or laterContainer runtime supports cgroup v2. For example:containerd v1.4 and latercri-o v1.20 and laterThe kubelet and the container runtime are configured to use the systemd cgroup driverLinux Distribution cgroup v2 supportFor a list of Linux distributions that use cgroup v2, refer to the cgroup v2 documentationContainer Optimized OS (since M97)Ubuntu (since 21.10, 22.04+ recommended)Debian GNU/Linux (since Debian 11 bullseye)Fedora (since 31)Arch Linux (since April 2021)RHEL and RHEL-like distributions (since 9)To check if your distribution is using cgroup v2, refer to your distribution's documentation or follow the instructions in Identify the cgroup version on Linux nodes.You can also enable cgroup v2 manually on your Linux distribution by modifying the kernel cmdline boot arguments. If your distribution uses GRUB, systemd.unified_cgroup_hierarchy=1 should be added in GRUB_CMDLINE_LINUX under /etc/default/grub, followed by sudo update-grub. However, the recommended approach is to use a distribution that already enables cgroup v2 by default.Migrating to cgroup v2To migrate to cgroup v2, ensure that you meet the requirements, then upgrade to a kernel version that enables cgroup v2 by default.The kubelet automatically detects that the OS is running on cgroup v2 and performs accordingly with no additional configuration required.There should not be any noticeable difference in th


Question: What is About cgroup v2?

Answer: O n   L i n u x ,   c o n t r o l   g r o u p s   c o n s t r a i n   r e s o u r c e s   t h a t   a r e   a l l o c a t e d   t o   p r o c e s s e s .   T h e   k u b e l e t   a n d   t h e   u n d e r l y i n g   c o n t a i n e r   r u n t i m e   n e e d   t o   i n t e r f a c e   w i t h   c g r o u p s   t o   e n f o r c e   r e s o u r c e   m a n a g e m e n t   f o r   p o d s   a n d   c o n t a i n e r s   w h i c h   i n c l u d e s   c p u / m e m o r y   r e q u e s t s   a n d   l i m i t s   f o r   c o n t a i n e r i z e d   w o r k l o a d s .   T h e r e   a r e   t w o   v e r s i o n s   o f   c g r o u p s   i n   L i n u x :   c g r o u p   v 1   a n d   c g r o u p   v 2 .   c g r o u p   v 2   i s   t h e   n e w   g e n e r a t i o n   o f   t h e   c g r o u p   A P I .


Question: What is What is cgroup v2??

Answer: c g r o u p   v 2   i s   t h e   n e x t   v e r s i o n   o f   t h e   L i n u x   c g r o u p   A P I .   c g r o u p   v 2   p r o v i d e s   a   u n i f i e d   c o n t r o l   s y s t e m   w i t h   e n h a n c e d   r e s o u r c e   m a n a g e m e n t   c a p a b i l i t i e s .   c g r o u p   v 2   o f f e r s   s e v e r a l   i m p r o v e m e n t s   o v e r   c g r o u p   v 1 ,   s u c h   a s   t h e   f o l l o w i n g :   S i n g l e   u n i f i e d   h i e r a r c h y   d e s i g n   i n   A P I S a f e r   s u b - t r e e   d e l e g a t i o n   t o   c o n t a i n e r s N e w e r   f e a t u r e s   l i k e   P r e s s u r e   S t a l l   I n f o r m a t i o n E n h a n c e d   r e s o u r c e   a l l o c a t i o n   m a n a g e m e n t   a n d   i s o l a t i o n   a c r o s s   m u l t i p l e   r e s o u r c e s U n i f i e d   a c c o u n t i n g   f o r   d i f f e r e n t   t y p e s   o f   m e m o r y   a l l o c a t i o n s   ( n e t w o r k   m e m o r y ,   k e r n e l   m e m o r y ,   e t c ) A c c o u n t i n g   f o r   n o n - i m m e d i a t e   r e s o u r c e   c h a n g e s   s u c h   a s   p a g e   c a c h e   w r i t e   b a c k s   U n i f i e d   a c c o u n t i n g   f o r   d i f f e r e n t   t y p e s   o f   m e m o r y   a l l o c a t i o n s   ( n e t w o r k   m e m o r y ,   k e r n e l   m e m o r y ,   e t c ) A c c o u n t i n g   f o r   n o n - i m m e d i a t e   r e s o u r c e   c h a n g e s   s u c h   a s   p a g e   c a c h e   w r i t e   b a c k s   S o m e   K u b e r n e t e s   f e a t u r e s   e x c l u s i v e l y   u s e   c g r o u p   v 2   f o r   e n h a n c e d   r e s o u r c e   m a n a g e m e n t   a n d   i s o l a t i o n .   F o r   e x a m p l e ,   t h e   M e m o r y Q o S   f e a t u r e   i m p r o v e s   m e m o r y   Q o S   a n d   r e l i e s   o n   c g r o u p   v 2   p r i m i t i v e s .


Question: What is Using cgroup v2?

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


Question: What is Requirements?

Answer: c g r o u p   v 2   h a s   t h e   f o l l o w i n g   r e q u i r e m e n t s :   O S   d i s t r i b u t i o n   e n a b l e s   c g r o u p   v 2 L i n u x   K e r n e l   v e r s i o n   i s   5 . 8   o r   l a t e r C o n t a i n e r   r u n t i m e   s u p p o r t s   c g r o u p   v 2 .   F o r   e x a m p l e : c o n t a i n e r d   v 1 . 4   a n d   l a t e r c r i - o   v 1 . 2 0   a n d   l a t e r T h e   k u b e l e t   a n d   t h e   c o n t a i n e r   r u n t i m e   a r e   c o n f i g u r e d   t o   u s e   t h e   s y s t e m d   c g r o u p   d r i v e r   c o n t a i n e r d   v 1 . 4   a n d   l a t e r c r i - o   v 1 . 2 0   a n d   l a t e r


Question: What is Linux Distribution cgroup v2 support?

Answer: F o r   a   l i s t   o f   L i n u x   d i s t r i b u t i o n s   t h a t   u s e   c g r o u p   v 2 ,   r e f e r   t o   t h e   c g r o u p   v 2   d o c u m e n t a t i o n   C o n t a i n e r   O p t i m i z e d   O S   ( s i n c e   M 9 7 ) U b u n t u   ( s i n c e   2 1 . 1 0 ,   2 2 . 0 4 +   r e c o m m e n d e d ) D e b i a n   G N U / L i n u x   ( s i n c e   D e b i a n   1 1   b u l l s e y e ) F e d o r a   ( s i n c e   3 1 ) A r c h   L i n u x   ( s i n c e   A p r i l   2 0 2 1 ) R H E L   a n d   R H E L - l i k e   d i s t r i b u t i o n s   ( s i n c e   9 )   T o   c h e c k   i f   y o u r   d i s t r i b u t i o n   i s   u s i n g   c g r o u p   v 2 ,   r e f e r   t o   y o u r   d i s t r i b u t i o n ' s   d o c u m e n t a t i o n   o r   f o l l o w   t h e   i n s t r u c t i o n s   i n   I d e n t i f y   t h e   c g r o u p   v e r s i o n   o n   L i n u x   n o d e s .   Y o u   c a n   a l s o   e n a b l e   c g r o u p   v 2   m a n u a l l y   o n   y o u r   L i n u x   d i s t r i b u t i o n   b y   m o d i f y i n g   t h e   k e r n e l   c m d l i n e   b o o t   a r g u m e n t s .   I f   y o u r   d i s t r i b u t i o n   u s e s   G R U B ,   s y s t e m d . u n i f i e d _ c g r o u p _ h i e r a r c h y = 1   s h o u l d   b e   a d d e d   i n   G R U B _ C M D L I N E _ L I N U X   u n d e r   / e t c / d e f a u l t / g r u b ,   f o l l o w e d   b y   s u d o   u p d a t e - g r u b .   H o w e v e r ,   t h e   r e c o m m e n d e d   a p p r o a c h   i s   t o   u s e   a   d i s t r i b u t i o n   t h a t   a l r e a d y   e n a b l e s   c g r o u p   v 2   b y   d e f a u l t .


Question: What is Migrating to cgroup v2?

Answer: T o   m i g r a t e   t o   c g r o u p   v 2 ,   e n s u r e   t h a t   y o u   m e e t   t h e   r e q u i r e m e n t s ,   t h e n   u p g r a d e   t o   a   k e r n e l   v e r s i o n   t h a t   e n a b l e s   c g r o u p   v 2   b y   d e f a u l t .   T h e   k u b e l e t   a u t o m a t i c a l l y   d e t e c t s   t h a t   t h e   O S   i s   r u n n i n g   o n   c g r o u p   v 2   a n d   p e r f o r m s   a c c o r d i n g l y   w i t h   n o   a d d i t i o n a l   c o n f i g u r a t i o n   r e q u i r e d .   T h e r e   s h o u l d   n o t   b e   a n y   n o t i c e a b l e   d i f f e r e n c e   i n   t h e   u s e r   e x p e r i e n c e   w h e n   s w i t c h i n g   t o   c g r o u p   v 2 ,   u n l e s s   u s e r s   a r e   a c c e s s i n g   t h e   c g r o u p   f i l e   s y s t e m   d i r e c t l y ,   e i t h e r   o n   t h e   n o d e   o r   f r o m   w i t h i n   t h e   c o n t a i n e r s .   c g r o u p   v 2   u s e s   a   d i f f e r e n t   A P I   t h a n   c g r o u p   v 1 ,   s o   i f   t h e r e   a r e   a n y   a p p l i c a t i o n s   t h a t   d i r e c t l y   a c c e s s   t h e   c g r o u p   f i l e   s y s t e m ,   t h e y   n e e d   t o   b e   u p d a t e d   t o   n e w e r   v e r s i o n s   t h a t   s u p p o r t   c g r o u p   v 2 .   F o r   e x a m p l e :   S o m e   t h i r d - p a r t y   m o n i t o r i n g   a n d   s e c u r i t y   a g e n t s   m a y   d e p e n d   o n   t h e   c g r o u p   f i l e s y s t e m .   U p d a t e   t h e s e   a g e n t s   t o   v e r s i o n s   t h a t   s u p p o r t   c g r o u p   v 2 . I f   y o u   r u n   c A d v i s o r   a s   a   s t a n d - a l o n e   D a e m o n S e t   f o r   m o n i t o r i n g   p o d s   a n d   c o n t a i n e r s ,   u p d a t e   i t   t o   v 0 . 4 3 . 0   o r   l a t e r . I f   y o u   d e p l o y   J a v a   a p p l i c a t i o n s ,   p r e f e r   t o   u s e   v e r s i o n s   w h i c h   f u l


Question: What is Identify the cgroup version on Linux Nodes?

Answer: T h e   c g r o u p   v e r s i o n   d e p e n d s   o n   t h e   L i n u x   d i s t r i b u t i o n   b e i n g   u s e d   a n d   t h e   d e f a u l t   c g r o u p   v e r s i o n   c o n f i g u r e d   o n   t h e   O S .   T o   c h e c k   w h i c h   c g r o u p   v e r s i o n   y o u r   d i s t r i b u t i o n   u s e s ,   r u n   t h e   s t a t   - f c   % T   / s y s / f s / c g r o u p /   c o m m a n d   o n   t h e   n o d e :   s t a t   - f c   % T   / s y s / f s / c g r o u p /   F o r   c g r o u p   v 2 ,   t h e   o u t p u t   i s   c g r o u p 2 f s .   F o r   c g r o u p   v 1 ,   t h e   o u t p u t   i s   t m p f s .


Question: What is What's next?

Answer: L e a r n   m o r e   a b o u t   c g r o u p s L e a r n   m o r e   a b o u t   c o n t a i n e r   r u n t i m e L e a r n   m o r e   a b o u t   c g r o u p   d r i v e r s


Question: What is Managing Workloads?

Answer: Managing WorkloadsYou've deployed your application and exposed it via a Service. Now what? Kubernetes provides a number of tools to help you manage your application deployment, including scaling and updating.Organizing resource configurationsMany applications require multiple resources to be created, such as a Deployment along with a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by --- in YAML). For example:application/nginx-app.yaml apiVersion: v1 kind: Service metadata: name: my-nginx-svc labels: app: nginx spec: type: LoadBalancer ports: - port: 80 selector: app: nginx --- apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Multiple resources can be created the same way as a single resource:kubectl apply -f https://k8s.io/examples/application/nginx-app.yaml service/my-nginx-svc created deployment.apps/my-nginx created The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the Service as they are created by the controller(s), such as Deployment.kubectl apply also accepts multiple -f arguments:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \ -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, you can deploy all of the components of your stack together.A URL can also be specified as a configuration source, which is handy for deploying directly from manifests in your source control system:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml deployment.apps/my-nginx created If you need to define more manifests, such as adding a ConfigMap, you can do that too.External toolsThis section lists only the most common tools used for managing workloads on Kubernetes. To see a larger list, view Application definition and image build in the CNCF Landscape.Helm🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationHelm is a tool for managing packages of pre-configured Kubernetes resources. These packages are known as Helm charts.KustomizeKustomize traverses a Kubernetes manifest to add, remove or update configuration options. It is available both as a standalone binary and as a native feature of kubectl.Bulk operations in kubectlResource creation isn't the only operation that kubectl can perform in bulk. It can also extract resource names from configuration files in order to


Question: How does Managing Workloads work?

Answer: Managing WorkloadsYou've deployed your application and exposed it via a Service. Now what? Kubernetes provides a number of tools to help you manage your application deployment, including scaling and updating.Organizing resource configurationsMany applications require multiple resources to be created, such as a Deployment along with a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by --- in YAML). For example:application/nginx-app.yaml apiVersion: v1 kind: Service metadata: name: my-nginx-svc labels: app: nginx spec: type: LoadBalancer ports: - port: 80 selector: app: nginx --- apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Multiple resources can be created the same way as a single resource:kubectl apply -f https://k8s.io/examples/application/nginx-app.yaml service/my-nginx-svc created deployment.apps/my-nginx created The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the Service as they are created by the controller(s), such as Deployment.kubectl apply also accepts multiple -f arguments:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \ -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, you can deploy all of the components of your stack together.A URL can also be specified as a configuration source, which is handy for deploying directly from manifests in your source control system:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml deployment.apps/my-nginx created If you need to define more manifests, such as adding a ConfigMap, you can do that too.External toolsThis section lists only the most common tools used for managing workloads on Kubernetes. To see a larger list, view Application definition and image build in the CNCF Landscape.Helm🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationHelm is a tool for managing packages of pre-configured Kubernetes resources. These packages are known as Helm charts.KustomizeKustomize traverses a Kubernetes manifest to add, remove or update configuration options. It is available both as a standalone binary and as a native feature of kubectl.Bulk operations in kubectlResource creation isn't the only operation that kubectl can perform in bulk. It can also extract resource names from configuration files in order to


Question: When would you use Managing Workloads?

Answer: Managing WorkloadsYou've deployed your application and exposed it via a Service. Now what? Kubernetes provides a number of tools to help you manage your application deployment, including scaling and updating.Organizing resource configurationsMany applications require multiple resources to be created, such as a Deployment along with a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by --- in YAML). For example:application/nginx-app.yaml apiVersion: v1 kind: Service metadata: name: my-nginx-svc labels: app: nginx spec: type: LoadBalancer ports: - port: 80 selector: app: nginx --- apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 Multiple resources can be created the same way as a single resource:kubectl apply -f https://k8s.io/examples/application/nginx-app.yaml service/my-nginx-svc created deployment.apps/my-nginx created The resources will be created in the order they appear in the manifest. Therefore, it's best to specify the Service first, since that will ensure the scheduler can spread the pods associated with the Service as they are created by the controller(s), such as Deployment.kubectl apply also accepts multiple -f arguments:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-svc.yaml \ -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml It is a recommended practice to put resources related to the same microservice or application tier into the same file, and to group all of the files associated with your application in the same directory. If the tiers of your application bind to each other using DNS, you can deploy all of the components of your stack together.A URL can also be specified as a configuration source, which is handy for deploying directly from manifests in your source control system:kubectl apply -f https://k8s.io/examples/application/nginx/nginx-deployment.yaml deployment.apps/my-nginx created If you need to define more manifests, such as adding a ConfigMap, you can do that too.External toolsThis section lists only the most common tools used for managing workloads on Kubernetes. To see a larger list, view Application definition and image build in the CNCF Landscape.Helm🛇 This item links to a third party project or product that is not part of Kubernetes itself. More informationHelm is a tool for managing packages of pre-configured Kubernetes resources. These packages are known as Helm charts.KustomizeKustomize traverses a Kubernetes manifest to add, remove or update configuration options. It is available both as a standalone binary and as a native feature of kubectl.Bulk operations in kubectlResource creation isn't the only operation that kubectl can perform in bulk. It can also extract resource names from configuration files in order to