0
votes

We use terraform resource "kubernetes_deployment" to deploy our pods. Our pods have readiness probes, but these probes are not good enough because we need external feedback to decide if a pod is ready. In our case, a pod is ready only after external program creates a file in aws S3 bucket, and this is a manual step, which may be completed at random time (can be several days/weeks) so readiness probe is not good, becuase it will fail and leave our pod in "unready" state. We understand kubernetes 1.14 introduced something called readiness-gate. See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate However it seems terraform resource "kubernetes_deployment" does not support pod readiness-gates.

Note that we prefer using kubernetes deployment (rather than defining pods directly) because we need rolling update strategy.

How can we define pod readiness-gates with terraform?

2
i opened a feature request for this on terreform-kubernetes github repo: github.com/terraform-providers/terraform-provider-kubernetes/…Assaf

2 Answers

0
votes

Currently you cannot define pod readiness-gates with terraform.

You can create a feature request on terreform-kubernetes github repo or add this functionality by yourself and create a pull request.

For now you can use initContainers (as already mentioned by Yuri) or use readiness probe with command that uses bash to string together check for an application readiness and existence of a file.

But probably the best thing you could do is to rewrite your application, so it can handle the case when file doesn't exist yet.

0
votes

Try to use initcontainer to check the status of S3 bucket. I sent you an example below:

’’ initContainers: - name: install image: busybox command: - wget - "-O" - "/work-dir/index.html" - http://kubernetes.io ’’