<p>As a leaner of Kubernetes concepts, their working, and deployment with it. I have a couple of cases which I don't know how to achieve. I am looking for advice or some guideline to achieve it.</p>

<p>I am using the Google Cloud Platform. The current running flow is described below. A push to the google source repository triggers Cloud Build which creates a docker image and pushes the image to the running cluster nodes.</p>

<p>Case 1: Now I want that when new pods are up and running. Then traffic is routed to the new pods. Kill old pod but after each pod complete their running request. Zero downtime is what I'm looking to achieve.</p>

<p>Case 2: What will happen if the space of running pod reaches 100 and in the Debian case that the inode count reaches full capacity. Will kubernetes create new pods to manage?</p>

<p>Case 3: How to manage pod to database connection limits?</p>

<ol>
<li><p>Like the other answer use <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/" rel="nofollow noreferrer">Liveness and Readiness probes</a>. Basically, a new pod is added to the service pool then it will only serve traffic after the readiness probe has passed. The old pod is removed from the Service pool, then drained and then terminated. This happens on a rolling fashion one pod at a time.</p></li>
<li><p>This really depends on the capacity of your cluster and the ability to schedule pods depending on the limits for the containers in them. For more about setting up limits for containers refer to <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" rel="nofollow noreferrer">here</a>. In terms of the inode limit, if you reach it on a node, the kubelet won't be able to run any more pods on that node. The kubelet eviction manager also has a <a href="https://github.com/kubernetes/kubernetes/pull/35137" rel="nofollow noreferrer">mechanism</a> in where evicts some pods using the most inodes. You can also configure your <a href="https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/#eviction-policy" rel="nofollow noreferrer">eviction thresholds</a> on the kubelet.</p></li>
<li><p>This would be more a limitation at the OS level combined your stateful application configuration. You can keep this configuration in a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer">ConfigMap</a>. And for example in something for MySql the option would be <a href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections" rel="nofollow noreferrer">max_connections</a>.</p></li>
</ol>
