Kubernetes postStart lifecycle always failing Kubernetes postStart lifecycle always failing kubernetes kubernetes

Kubernetes postStart lifecycle always failing


You can use readinessProbe as well with the livenessProbe like this:

        readinessProbe:            httpGet:                path: /api/health                port: 8080        initialDelaySeconds: 10        periodSeconds: 5        failureThreshold: 8        // for tcpSocket use:            readinessProbe:                tcpSocket:                    port: 3306 


That is because your command in postStart is sleeping for 10 seconds and your LivenessProbe is configured to fail after 5 seconds.

Maybe increase initialDelaySeconds or add a failureThreshold.