Skip to content

Commit 1496a68

Browse files
author
marcel
committed
update
1 parent c84e2ec commit 1496a68

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
11
# k8s-wait-for
22
Go cli app to wait for kubernetes pod/jobs to come ready
3+
4+
Example how to use it:
5+
6+
```yaml
7+
kind: StatefulSet
8+
metadata:
9+
name: myapp
10+
labels:
11+
app: myapp
12+
chart: example
13+
annotations:
14+
version: "0.1"
15+
spec:
16+
selector:
17+
matchLabels:
18+
app: myapp
19+
chart: example
20+
serviceName: myapp
21+
template:
22+
metadata:
23+
labels:
24+
app: myapp
25+
chart: example
26+
annotations:
27+
version: "0.2.17"
28+
spec:
29+
initContainers:
30+
- name: wait-for-database
31+
image: ghcr.io/syntax3rror404/k8s-wait-for:main
32+
imagePullPolicy: Always
33+
args:
34+
- "job"
35+
- "-n myapp"
36+
- "-l app=database"
37+
containers:
38+
- name: myapp
39+
image: ghcr.io/example/myapp:latest
40+
imagePullPolicy: Always
41+
```
42+
43+
See help command for more information:
44+
```
45+
waitfor.exe -h
46+
This tool waits for kubernetes pods or jobs to be ready
47+
48+
a common usecase is to use it as init container to wait for other pods to be ready before starting the main application.
49+
For example waiting for a database to be ready before starting the app to prevent errors.
50+
51+
Example:
52+
waitfor pod -n vault -l app.kubernetes.io/instance=vault
53+
waitfor job -n snipeit -l job=generate-app-key
54+
55+
Usage:
56+
waitfor [command]
57+
58+
Available Commands:
59+
completion Generate the autocompletion script for the specified shell
60+
help Help about any command
61+
job wait for a job to complete
62+
pod wait for a pod to be ready
63+
64+
Flags:
65+
-h, --help help for waitfor
66+
-l, --label string Label to filter (required)
67+
-n, --namespace string Namespace to use (default "default")
68+
-t, --timer int32 Wait time between checks (default 3)
69+
70+
Use "waitfor [command] --help" for more information about a command.
71+
```

0 commit comments

Comments
 (0)