-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinit-container-test-1.yaml
37 lines (34 loc) · 1005 Bytes
/
init-container-test-1.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Init containers always complete before main container. If a container fails to start due to the runtime or exists with failure
# It is retried according to the Pod `restartPolicy`.
# If Pod restart policy is set to `Always` then the init containers use restartPolicy `OnFailure`.
#
apiVersion: v1
metadata:
name: policy-checker
labels:
check: policy
kind: Pod
spec:
volumes:
- name: test-policy
emptyDir: {}
containers:
- name: policy-checker
image: alpine
volumeMounts:
- name: test-policy
mountPath: /tmp/
command:
- sh
- -c
- echo -n "Completed successfully without any error - restartPolicy `Always` -- MainContainer" >> /tmp/app.log; sleep 4500;
initContainers:
- image: busybox:1.28
name: init-policy
command:
- sh
- -c
- echo " restartPolicy set to OnFailure - InitContainers" > /tmp/app.log;sleep 5;
volumeMounts:
- name: test-policy
mountPath: /tmp/