<p>We have a simple Spring Boot web application which takes less than 30 seconds to start. So I configured the probes as follow:</p>
<pre><code>    readinessProbe:
      httpGet:
        path: /actuator/health/readiness
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 1
    livenessProbe:
      httpGet:
        path: /actuator/health/liveness
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 1
</code></pre>
<p>My understanding is that readiness probe waits for 30 seconds and then will succeed (if the application is started). And also liveness probe with 30 seconds delay (from the beginning of the deployment) starts and will succeeds almost at the same time readiness probe succeeds (if the application is ready). But what I see in logs is that readiness probe waits for 30 seconds and then succeeds, but after that there's another 30 seconds waiting time and then the old pod gets shut down:</p>
<pre><code>develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:07.378Z&quot;,&quot;logger&quot;:&quot;org.springframework.boot.web.embedded.tomcat.TomcatWebServer&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;main&quot;,&quot;message&quot;:&quot;Tomcat started on port(s): 8080 (http) with context path ''&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:07.387Z&quot;,&quot;logger&quot;:&quot;org.springframework.data.repository.config.DeferredRepositoryInitializationListener&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;main&quot;,&quot;message&quot;:&quot;Triggering deferred initialization of Spring Data repositories…&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:09.441Z&quot;,&quot;logger&quot;:&quot;org.springframework.data.repository.config.DeferredRepositoryInitializationListener&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;main&quot;,&quot;message&quot;:&quot;Spring Data repositories initialized!&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:09.469Z&quot;,&quot;logger&quot;:&quot;com.example.Application&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;main&quot;,&quot;message&quot;:&quot;Started Application in 23.918 seconds (JVM running for 25.343)&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:14.251Z&quot;,&quot;logger&quot;:&quot;org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;http-nio-8080-exec-1&quot;,&quot;message&quot;:&quot;Initializing Spring DispatcherServlet 'dispatcherServlet'&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:14.258Z&quot;,&quot;logger&quot;:&quot;org.springframework.web.servlet.DispatcherServlet&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;http-nio-8080-exec-1&quot;,&quot;message&quot;:&quot;Initializing Servlet 'dispatcherServlet'&quot;}
develop/demo-57c8984866-6v5sl[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:14.292Z&quot;,&quot;logger&quot;:&quot;org.springframework.web.servlet.DispatcherServlet&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;http-nio-8080-exec-1&quot;,&quot;message&quot;:&quot;Completed initialization in 30 ms&quot;}
develop/demo-79cc9bc757-xlg6z[demo]: 2020-10-08T17:33:44.590172 Shutting down...
develop/demo-79cc9bc757-xlg6z[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:44.658Z&quot;,&quot;logger&quot;:&quot;org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;SpringContextShutdownHook&quot;,&quot;message&quot;:&quot;Closing JPA EntityManagerFactory for persistence unit 'default'&quot;}
develop/demo-79cc9bc757-xlg6z[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:44.664Z&quot;,&quot;logger&quot;:&quot;org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;SpringContextShutdownHook&quot;,&quot;message&quot;:&quot;Shutting down ExecutorService 'applicationTaskExecutor'&quot;}
develop/demo-79cc9bc757-xlg6z[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:44.667Z&quot;,&quot;logger&quot;:&quot;com.zaxxer.hikari.HikariDataSource&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;SpringContextShutdownHook&quot;,&quot;message&quot;:&quot;HikariPool-1 - Shutdown initiated...&quot;}
develop/demo-79cc9bc757-xlg6z[demo]: {&quot;ts&quot;:&quot;2020-10-08T17:33:44.680Z&quot;,&quot;logger&quot;:&quot;com.zaxxer.hikari.HikariDataSource&quot;,&quot;level&quot;:&quot;INFO&quot;,&quot;thread&quot;:&quot;SpringContextShutdownHook&quot;,&quot;message&quot;:&quot;HikariPool-1 - Shutdown completed.&quot;}
</code></pre>
<p>What's the reason for the 2nd 30-second waiting time (see the first &quot;Shutting down...&quot;)? For the record, there's not SIGTERM problem (the application responds properly to SIGTERM).</p>
<p>MORE INFO<br />
Correct me if I'm wrong about how these probes work: The container starts, at this moment the timer for readiness initial delay also starts. 25 sec later the app is ready. 5 more sec later, the readiness probe starts hitting the app/container and it succeeds, thus the app is ready (right?). At this point I expect k8s send the sigterm to the old pod, asking it to shut down. But as shown in the logs, after the new container is ready, the old pod is still running for 30 more sec.<br />
Maybe, rephrasing the question helps. I'd like to shut down old pod right after the app is ready. And the app is ready in less than 30 sec. In other words I need the whole deployment to take only 30 sec (considering the startup is less than 30 sec and shutdown is less than one sec). Why the above configuration doesn't do that?
Thanks.</p>

Rad
<p>OK, it turned out the tool (<a href="https://github.com/bitnami/kubecfg" rel="nofollow noreferrer">kubecfg</a>) and library we use to manage our k8s manifests has a different default value for <code>minReadySeconds</code> property (30 seconds). I changed that and everything is working as expected.</p>
