kubernetes

Kubernetes resources


I have a couple of questions regarding Kubernetes

  1. I set memory request, limit as 300Mi and 600Mi respectively for a deployment. I have tested that if any POD reaches 600Mi then Kubernetes is terminating the POD and creating a new POD. My doubt is when POD is while terminating does POD drop any incoming requests or does cluster load balancer takes care this situation and routes the incoming requests to any other available POD's in the deployment.

  2. What happens if all available POD's reaches the memory limit at the same time. Generally, it takes few minutes to creates new POD's. In this case, how kubernetes load balancer works, does it drops any incoming requests.

  3. Is there any way to set life time for a POD ?


Solution

    1. Do you have Service in front of your Deployment Pods. If yes, then all requests coming through that Service will be forwarded to its available Endpoints. When a Pod is termination, Service removes that Pods IP from its Endpoint list. So, any requests that are coming will be forwarded to existing Pods

    The set of Pods targeted by a Service is (usually) determined by a Label Selector

    Read more about services-networking

    1. In case of any reason, if all Pods are terminating and new Pods are not ready yet, then yes, some requests will be lost.

    It first created a new Pod, then deleted some old Pods and created new ones. It does not kill old Pods until a sufficient number of new Pods have come up, and does not create new Pods until a sufficient number of old Pods have been killed

    Read more about deployment behavior