Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes wait for secret to be created

How can I wait in Kubernetes till a secret is created? There is kubectl wait ... which I see examples for pods and deployments, but how can I use it for secrets?


1 Answers

How can I wait in Kubernetes till a secret is created? There is kubectl wait ...

Try:

while ! kubectl get secret <name> --namespace <if not default>; do echo "Waiting for my secret. CTRL-C to exit."; sleep 1; done

like image 194
gohm'c Avatar answered Sep 09 '25 05:09

gohm'c