k8s-wait-for
by groundnuty
A simple script that waits for Kubernetes services, jobs, or pods to reach a desired state to facilitate deployment and automation workflows.
A simple script that allows to wait for a k8s service, job or pods to enter a desired state
Primary Use Case
This tool is primarily used by Kubernetes administrators and DevOps engineers to automate and streamline deployment processes by waiting for specific Kubernetes resources to become ready or complete. It helps ensure that dependent services or jobs have reached their expected states before proceeding with further automation or deployment steps.
- Waits for Kubernetes jobs, pods, or services to enter desired states such as Ready, Succeeded, or Failed
- Supports label selectors for targeting multiple resources
- Provides variants to wait for all or at least one resource to reach the desired state
- Compatible with Kubernetes versions <=1.23 using specific versions
- Available as a container image for easy execution within clusters
- Includes built-in help and usage examples
- Integrates with Kubernetes CLI (kubectl) for seamless operation
Installation
- Run the tool directly on a Kubernetes cluster using kubectl with the provided container image:
- kubectl run k8s-wait-for --rm -it --image ghcr.io/groundnuty/k8s-wait-for:v2.0 --restart Never --command /bin/sh
- Use the built-in help command to explore usage options:
- / > wait_for.sh -h
Usage
>_ wait_for.sh job [<job name> | -l<kubectl selector>]Waits for all pods in the specified job to reach the 'Succeeded' state.
>_ wait_for.sh pod [<pod name> | -l<kubectl selector>]Waits for all pods matching the name or label selector to enter the 'Ready' state.
>_ wait_for.sh service [<service name> | -l<kubectl selector>]Waits for the specified Kubernetes service to become ready.
>_ wait_for.sh pod -lapp=develop-volume-gluster-krakowWaits for all pods with the label 'app=develop-volume-gluster-krakow' to enter the 'Ready' state.
>_ wait_for.sh pod -l"release in (develop), chart notin (cross-support-job-3p)"Waits for all pods matching a complex label selector to enter the 'Ready' state.
>_ wait_for.sh pod-we -lapp=develop-volume-gluster-krakowWaits for all pods with the label 'app=develop-volume-gluster-krakow' to enter either 'Ready' or 'Error' state.
>_ wait_for.sh pod-wr -lapp=develop-volume-gluster-krakowWaits for at least one pod with the label 'app=develop-volume-gluster-krakow' to enter the 'Ready' state, ignoring others in 'Error' state.
>_ wait_for.sh job-we develop-volume-s3-krakow-initWaits for all pods in the specified job to reach either 'Succeeded' or 'Failed' state.
>_ wait_for.sh job-wr develop-volume-s3-krakow-initWaits for at least one pod in the specified job to reach 'Succeeded' state, ignoring some 'Failed' pods.
- Integrate this script into CI/CD pipelines to automate deployment gating based on Kubernetes resource readiness, reducing deployment errors.
- Use in blue team playbooks to automate detection of abnormal pod or job states that may indicate compromise or misconfiguration.
- Combine with Kubernetes audit logs and monitoring tools to enhance situational awareness of cluster state changes.
- Leverage the containerized version to run within Kubernetes clusters for seamless integration with existing automation workflows.
- Extend the script to trigger automated remediation or alerting when resources fail to reach desired states within expected timeframes.
Docs Take 2 Hours. AI Takes 10 Seconds.
Ask anything about k8s-wait-for. Installation? Config? Troubleshooting? Get answers trained on real docs and GitHub issues—not generic ChatGPT fluff.
This tool hasn't been indexed yet. Request indexing to enable AI chat.
Admin will review your request within 24 hours
Related Tools
ProxmoxVE
community-scripts/ProxmoxVE
Proxmox VE Helper-Scripts (Community Edition)
prowler
prowler-cloud/prowler
Prowler is the world’s most widely used open-source cloud security platform that automates security and compliance across any cloud environment.

aws-cdk
aws/aws-cdk
The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
my-arsenal-of-aws-security-tools
toniblyx/my-arsenal-of-aws-security-tools
List of open source tools for AWS security: defensive, offensive, auditing, DFIR, etc.

keda
kedacore/keda
KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes

DevOps-Guide
Tikam02/DevOps-Guide
DevOps Guide - Development to Production all configurations with basic notes to debug efficiently.
