Skip to content

Commit 4612c2b

Browse files
committed
add initContainer for app deployemnt to ensure mysql service is healthy
1 parent 15e2266 commit 4612c2b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

code/docker/4-kapend/myfirst/k8s/03-kapend.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ spec:
1212
labels:
1313
app: kapend-app
1414
spec:
15+
initContainers:
16+
- name: wait-for-mysql
17+
image: busybox:1.28
18+
command:
19+
- sh
20+
- -c
21+
- >
22+
until nslookup mysql-service; do
23+
echo 'Waiting for MySQL to be ready';
24+
sleep 2;
25+
done
1526
containers:
1627
- name: kapend-app
1728
image: stark275/kapend:v2

0 commit comments

Comments
 (0)