I have been trying to setup a readinessProbe.
I have a spring boot actuator end point like: /actuator/health/readiness
.
I cannot use the standard httpGet
probe because this endpoint is secured with TLS, yes I have tried scheme:HTTPS
doesn't work. Gives error remote error: tls: bad certificate
so I wrote my readinessProbe something like:
readinessProbe:
exec:
command:
- sh
- -c
- curl -k --cert /mnt/secret/cert.pem --key /mnt/secret/key.pem "https://localhost:8083/actuator/health/readiness" | grep -q "UP"
initialDelaySeconds: 50
periodSeconds: 5
failureThreshold: 30
When this probe runs it produces the error: curl:(7) Failed to connect to localhost port 8083: Connection refused
After trying this, I then mounted a script running the same command on my pod. This produced the same error, but when execing into my pod and running this script it worked.
From what I understand, the readinessProbe is not being run inside the pod. So it doesnt have correct localHost.
I then tried using the external svc endpoint in the curl command... this did run the request but of course it does not work... because the pod is not ready, and it will never become ready as this request can only go through if the pod is in ready status.
I feel like I have exhausted all my ideas, to get around this issue. Any tips?