How can I wait for a Kubernetes install to be ready in a shell script?

November 13, 2026 5 answers
Asked by f21!gainstage

I'm applying the Argo CD installation manifest from a shell script and want to wait before running commands against it. The manifest includes service accounts and other resources that don't have a Ready condition, so waiting on the whole file doesn't work. What should I wait for instead?

Answers

.spindleward

Wait for the Deployments and StatefulSets that the install creates, rather than applying one condition to every object in the manifest. For each workload, kubectl rollout status can wait for its rollout to finish. Set a timeout and stop the script if it fails.

A successful rollout tells you the workload got far enough for its pods to run and become ready. It does not prove that every Service, Ingress, CRD, or other independent resource is present or usable. Check those separately if the next step depends on them.

f21!gainstage:

Does a ready Deployment guarantee that all the service accounts and other dependencies in the manifest exist?

UPPER.case.optional:

Not all of them. It gives you evidence about the dependencies that particular workload needs, not unrelated objects elsewhere in the manifest.

Reply to this answer
83dots_between_stops

If the next step talks to the Argo CD API, test that endpoint too. A workload rollout and an accessible API are different checks, especially if the script connects through an Ingress or another network path.

Use a retry loop with a deadline and a request timeout, then fail clearly if the endpoint never responds. A simple HTTP response is only an availability check, so use a more specific API check if the next command needs authentication or particular functionality.

Reply to this answer
9pencils_under_glass

For objects without a readiness condition, check for creation instead. Kubectl wait supports a create condition, and kubectl get in a bounded loop is another option. Neither means a Service is reachable or a CRD is established, though, so use a condition or functional check where that distinction matters.

Reply to this answer
b18+filterbank

You may not need a single definition of everything ready. Kubernetes controllers reconcile asynchronously, so let them do their work and gate only the next step on what it actually needs. That keeps the script from waiting on unrelated resources.

Reply to this answer
w3~irqmask

If you are open to changing the installation method, Helm has a wait option that can handle readiness checks for supported resources. Check the chart and Helm version's behavior rather than assuming every resource or external endpoint is covered.

Argo CD sync waves and hooks can help order resources managed by Argo CD later, but they don't solve the initial wait for Argo CD itself to come up.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions