I know that k8s have readynessProbe with httpGet method to check if service ready to work or not. Is there something like httpPost method to run POST request to /api/postService with some body and check return code? Or some tricky way to do it in yaml file.
I think this way is more reliable.
readinessProbe:
exec:
command:
- sh
- -c
- >-
curl -X POST http://localhost/api/postService -H 'Content-Type: application/json' -d '{\"test\": \"OK\"}'
Can be done by running curl as an exec readinessProbe:
readinessProbe:
exec:
command:
- "curl"
- "-X POST"
- "-f"
- "http://localhost/api/postService"
Of course you'd need to make sure to install curl in the Docker image that packages your service.