{"id":13680682,"url":"https://github.com/groundnuty/k8s-wait-for","last_synced_at":"2026-04-17T18:04:27.973Z","repository":{"id":37550134,"uuid":"84722913","full_name":"groundnuty/k8s-wait-for","owner":"groundnuty","description":"A simple script that allows to wait for a k8s service, job or pods to enter a desired state","archived":false,"fork":false,"pushed_at":"2025-01-07T01:13:36.000Z","size":85,"stargazers_count":610,"open_issues_count":10,"forks_count":132,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-30T00:34:39.384Z","etag":null,"topics":["chart","dependencies","helm","init-containers","kubernetes","synchronization"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/groundnuty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-03-12T12:14:54.000Z","updated_at":"2025-04-21T08:43:21.000Z","dependencies_parsed_at":"2024-01-14T15:21:23.925Z","dependency_job_id":"b6b6e72e-bc30-48c3-ae17-72bd2a53d4e5","html_url":"https://github.com/groundnuty/k8s-wait-for","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/groundnuty/k8s-wait-for","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groundnuty%2Fk8s-wait-for","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groundnuty%2Fk8s-wait-for/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groundnuty%2Fk8s-wait-for/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groundnuty%2Fk8s-wait-for/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/groundnuty","download_url":"https://codeload.github.com/groundnuty/k8s-wait-for/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groundnuty%2Fk8s-wait-for/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31939800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart","dependencies","helm","init-containers","kubernetes","synchronization"],"created_at":"2024-08-02T13:01:20.457Z","updated_at":"2026-04-17T18:04:27.953Z","avatar_url":"https://github.com/groundnuty.png","language":"Shell","funding_links":[],"categories":["Shell","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"[![Latest Release](https://img.shields.io/github/v/release/groundnuty/k8s-wait-for?logo=GitHub)](https://github.com/groundnuty/k8s-wait-for/releases/latest)\n[![Build Status](https://github.com/groundnuty/k8s-wait-for/actions/workflows/build-and-publish.yml/badge.svg)](https://github.com/groundnuty/k8s-wait-for/actions/workflows/build-and-publish.yml)\n[![Trivy Security Scan](https://github.com/groundnuty/k8s-wait-for/actions/workflows/trivy.yml/badge.svg)](https://github.com/groundnuty/k8s-wait-for/actions/workflows/trivy.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/607e33a0f020475f867fcf443bdab51b)](https://www.codacy.com/gh/groundnuty/k8s-wait-for/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=groundnuty/k8s-wait-for\u0026amp;utm_campaign=Badge_Grade)\n[![Latest Docker Tag](https://img.shields.io/docker/v/groundnuty/k8s-wait-for?logo=docker)](https://hub.docker.com/r/groundnuty/k8s-wait-for/tags)\n[![Latest GHCR Image](https://ghcr-badge.herokuapp.com/groundnuty/k8s-wait-for/tags?n=1\u0026label=GHCR%20Image)](https://github.com/groundnuty/k8s-wait-for/pkgs/container/k8s-wait-for)\n\n# k8s-wait-for\n\n\u003e This tool is still actively used and working stably despite not too frequent commits! Pull requests are most welcome!\n\n\u003e Important: For kubernetes versions \u003c=1.23, use k8s-wait-for version 2.1 or higher or k8s-wait-for versions 1.*. See [here](https://github.com/groundnuty/k8s-wait-for/issues/60#issuecomment-1313483011).\n\nA simple script that allows waiting for a k8s service, job or pods to enter the desired state.\n\n## Running\n\nYou can start simple. Run it on your cluster in a namespace you already have something deployed:\n\n```bash\nkubectl run k8s-wait-for --rm -it --image ghcr.io/groundnuty/k8s-wait-for:v2.0 --restart Never --command /bin/sh\n```\n\nRead `--help` and play with it!\n\n```bash\n/ \u003e wait_for.sh -h\nThis script waits until a job, pod or service enter a ready state. \n\nwait_for.sh job [\u003cjob name\u003e | -l\u003ckubectl selector\u003e]\nwait_for.sh pod [\u003cpod name\u003e | -l\u003ckubectl selector\u003e]\nwait_for.sh service [\u003cservice name\u003e | -l\u003ckubectl selector\u003e]\n\nExamples:\nWait for all pods with a following label to enter 'Ready' state:\nwait_for.sh pod -lapp=develop-volume-gluster-krakow\n\nWait for all selected pods to enter the 'Ready' state:\nwait_for.sh pod -l\"release in (develop), chart notin (cross-support-job-3p)\"\n\nWait for all pods with a following label to enter 'Ready' or 'Error' state:\nwait_for.sh pod-we -lapp=develop-volume-gluster-krakow\n\nWait for at least one pod to enter the 'Ready' state, even when the other ones are in 'Error' state:\nwait_for.sh pod-wr -lapp=develop-volume-gluster-krakow\n\nWait for all the pods in that job to have a 'Succeeded' state:\nwait_for.sh job develop-volume-s3-krakow-init\n\nWait for all the pods in that job to have a 'Succeeded' or 'Failed' state:\nwait_for.sh job-we develop-volume-s3-krakow-init\n\nWait for at least one pod in that job to have 'Succeeded' state, does not mind some 'Failed' ones:\nwait_for.sh job-wr develop-volume-s3-krakow-init\n```\n\n## Example\n\nA complex Kubernetes deployment manifest (generated by [helm](https://github.com/kubernetes/helm)). This deployment waits for one job to finish and 2 pods to enter a ready state.\n\n```bash\nkind: StatefulSet\nmetadata:\n  name: develop-oneprovider-krakow\n  labels:\n    app: develop-oneprovider-krakow\n    chart: oneprovider-krakow\n    release: develop\n    heritage: Tiller\n    component: oneprovider\n  annotations:\n    version: \"0.2.17\"\nspec:\n  selector:\n    matchLabels:\n      app: develop-oneprovider-krakow\n      chart: oneprovider-krakow\n      release: develop\n      heritage: Tiller\n      component: \"oneprovider\"\n  serviceName: develop-oneprovider-krakow\n  template:\n    metadata:\n      labels:\n        app: develop-oneprovider-krakow\n        chart: oneprovider-krakow\n        release: develop\n        heritage: Tiller\n        component: \"oneprovider\"\n      annotations:\n        version: \"0.2.17\"\n    spec:\n      initContainers:\n        - name: wait-for-onezone\n          image: ghcr.io/groundnuty/k8s-wait-for:v1.6\n          imagePullPolicy: Always\n          args:\n            - \"job\"\n            - \"develop-onezone-ready-check\"\n        - name: wait-for-volume-ceph\n          image: ghcr.io/groundnuty/k8s-wait-for:v1.6\n          imagePullPolicy: Always\n          args:\n            - \"pod\"\n            - \"-lapp=develop-volume-ceph-krakow\"\n        - name: wait-for-volume-gluster\n          image: ghcr.io/groundnuty/k8s-wait-for:v1.6\n          imagePullPolicy: Always\n          args:\n            - \"pod\"\n            - \"-lapp=develop-volume-gluster-krakow\"\n      containers:\n      - name: oneprovider\n        image: docker.onedata.org/oneprovider:ID-a3a9ff0d78\n        imagePullPolicy: Always\n```\n\n## Complex deployment use case\n\nThis container is used extensively in deployments of Onedata system [onedata/charts](https://github.com/onedata/charts) to specify dependencies. It leverages Kubernetes [init containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/), thus providing:\n\n    - a detailed event log in `kubectl describe \u003cpod\u003e`, on what init container is pod hanging at the moment.\n    - a comprehensive view in `kubectl get pods` output where init containers are shown in a form `Init:\u003cready\u003e/\u003ctotal\u003e`\n\nExample output from the deployment run of ~16 pod with dependencies just after deployment:\n\n```bash\nNAME                                                   READY     STATUS              RESTARTS   AGE\ndevelop-cross-support-job-3p-krk-3-lis-c-b4nv1         0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-krk-3-par-c-lis-n-z7x6w   0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-krk-3-x9719               0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-krk-g-par-3-ztvz0         0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-krk-g-v5lf2               0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-krk-n-par-3-pnbcm         0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-lis-3-cpj3f               0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-par-n-8zdt2               0/1       Init:0/1            0          11s\ndevelop-cross-support-job-3p-par-n-lis-c-kqdf0         0/1       Init:0/1            0          11s\ndevelop-oneclient-krakow-2773392814-wc1dv              0/1       Init:0/3            0          11s\ndevelop-oneclient-lisbon-3267879054-2v6cg              0/1       Init:0/3            0          9s\ndevelop-oneclient-paris-2076479302-f6hh9               0/1       Init:0/3            0          9s\ndevelop-onedata-cli-krakow-1801798075-b5wpj            0/1       Init:0/1            0          11s\ndevelop-onedata-cli-lisbon-139116355-fwtjv             0/1       Init:0/1            0          10s\ndevelop-onedata-cli-paris-2662312307-9z9l1             0/1       Init:0/1            0          11s\ndevelop-oneprovider-krakow-3634465102-tftc6            0/1       Pending             0          10s\ndevelop-oneprovider-lisbon-3034775369-8n31x            0/1       Init:0/3            0          8s\ndevelop-oneprovider-paris-3034358951-19mhf             0/1       Init:0/3            0          10s\ndevelop-onezone-304145816-dmxn1                        0/1       ContainerCreating   0          11s\ndevelop-volume-ceph-krakow-479580114-mkd1d             0/1       ContainerCreating   0          11s\ndevelop-volume-ceph-lisbon-1249181958-1f0mt            0/1       ContainerCreating   0          9s\ndevelop-volume-ceph-paris-400443052-dc347              0/1       ContainerCreating   0          9s\ndevelop-volume-gluster-krakow-761992225-sj06m          0/1       Running             0          11s\ndevelop-volume-gluster-lisbon-3947152141-jlmvb         0/1       Running             0          8s\ndevelop-volume-gluster-paris-3588749681-9bnw8          0/1       ContainerCreating   0          11s\ndevelop-volume-nfs-krakow-2528947555-6mxzt             1/1       Running             0          10s\ndevelop-volume-nfs-lisbon-3473018547-7nljf             0/1       ContainerCreating   0          11s\ndevelop-volume-nfs-paris-2956540513-4bdzt              0/1       ContainerCreating   0          11s\ndevelop-volume-s3-krakow-23786741-pdxtj                0/1       Running             0          9s\ndevelop-volume-s3-krakow-init-gqmmp                    0/1       Init:0/1            0          11s\ndevelop-volume-s3-lisbon-3912793669-d4xh5              0/1       Running             0          10s\ndevelop-volume-s3-lisbon-init-mq9nk                    0/1       Init:0/1            0          11s\ndevelop-volume-s3-paris-124394749-qwt18                0/1       Running             0          8s\ndevelop-volume-s3-paris-init-jb4k3                     0/1       Init:0/1            0          11s\n```\n\n1 min after, you can see the changes in the *Status* column:\n\n```bash\ndevelop-cross-support-job-3p-krk-3-lis-c-b4nv1         0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-krk-3-par-c-lis-n-z7x6w   0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-krk-3-x9719               0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-krk-g-par-3-ztvz0         0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-krk-g-v5lf2               0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-krk-n-par-3-pnbcm         0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-lis-3-cpj3f               0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-par-n-8zdt2               0/1       Init:0/1          0          1m\ndevelop-cross-support-job-3p-par-n-lis-c-kqdf0         0/1       Init:0/1          0          1m\ndevelop-oneclient-krakow-2773392814-wc1dv              0/1       Init:0/3          0          1m\ndevelop-oneclient-lisbon-3267879054-2v6cg              0/1       Init:0/3          0          58s\ndevelop-oneclient-paris-2076479302-f6hh9               0/1       Init:0/3          0          58s\ndevelop-onedata-cli-krakow-1801798075-b5wpj            0/1       Init:0/1          0          1m\ndevelop-onedata-cli-lisbon-139116355-fwtjv             0/1       Init:0/1          0          59s\ndevelop-onedata-cli-paris-2662312307-9z9l1             0/1       Init:0/1          0          1m\ndevelop-oneprovider-krakow-3634465102-tftc6            0/1       Init:1/3          0          59s\ndevelop-oneprovider-lisbon-3034775369-8n31x            0/1       Init:2/3          0          57s\ndevelop-oneprovider-paris-3034358951-19mhf             0/1       PodInitializing   0          59s\ndevelop-onezone-304145816-dmxn1                        0/1       Running           0          1m\ndevelop-volume-ceph-krakow-479580114-mkd1d             1/1       Running           0          1m\ndevelop-volume-ceph-lisbon-1249181958-1f0mt            1/1       Running           0          58s\ndevelop-volume-ceph-paris-400443052-dc347              1/1       Running           0          58s\ndevelop-volume-gluster-krakow-761992225-sj06m          1/1       Running           0          1m\ndevelop-volume-gluster-lisbon-3947152141-jlmvb         1/1       Running           0          57s\ndevelop-volume-gluster-paris-3588749681-9bnw8          1/1       Running           0          1m\ndevelop-volume-nfs-krakow-2528947555-6mxzt             1/1       Running           0          59s\ndevelop-volume-nfs-lisbon-3473018547-7nljf             1/1       Running           0          1m\ndevelop-volume-nfs-paris-2956540513-4bdzt              1/1       Running           0          1m\ndevelop-volume-s3-krakow-23786741-pdxtj                1/1       Running           0          58s\ndevelop-volume-s3-lisbon-3912793669-d4xh5              1/1       Running           0          59s\ndevelop-volume-s3-paris-124394749-qwt18                1/1       Running           0          57s\n```\n\n## Troubleshooting\n\nVerify that you can access the Kubernetes API from within the k8s-wait-for container by running `kubectl get services`. If you get a permissions error like\n\n`Error from server (Forbidden): services is forbidden: User \"system:serviceaccount:default:default\" cannot list resource \"services\" in API group \"\" in the namespace \"default\"`\n\nthe pod lacks the permissions to perform the `kubectl get` query. To fix this, follow the instrctions for the 'pod-reader' role and clusterrole [here](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#kubectl-create-role\n).\n\nor use these command lines which add services and deployments to the pods in those examples:\n`kubectl create role pod-reader --verb=get --verb=list --verb=watch --resource=pods,services,deployments`\n\n`kubectl create rolebinding default-pod-reader --role=pod-reader --serviceaccount=default:default --namespace=default`\n\nAn extensive discussion on the problem of granting necessary permissions and a number of example solutions can be found [here](https://github.com/groundnuty/k8s-wait-for/issues/6).\n\nMake sure the service account is mounted. `The connection to the server localhost:8080 was refused - did you specify the right host or port?` might indicate that the service account is not mounted to the pod. Double check whether your service account and pod define `automountServiceAccountToken: true`. If the service account is mounted, you should see files inside `/var/run/secrets/kubernetes.io/serviceaccount` folder, otherwise `/var/run/secrets/kubernetes.io` might not exist at all.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroundnuty%2Fk8s-wait-for","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroundnuty%2Fk8s-wait-for","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroundnuty%2Fk8s-wait-for/lists"}