File tree 4 files changed +109
-64
lines changed
4 files changed +109
-64
lines changed Original file line number Diff line number Diff line change 1
1
apiVersion : v1
2
2
kind : Pod
3
3
metadata :
4
- # creationTimestamp: null
5
- labels :
6
- run : alpine-2-containers
7
4
name : alpine-2-containers
5
+ labels :
6
+ app : alpine-2-containers
8
7
spec :
9
8
containers :
10
- - args :
11
- - /bin/sh
12
- - -c
13
- - echo hello;sleep 10000
14
- image : alpine
15
- name : alpine1
16
- # resources: {}
17
- - args :
18
- - /bin/sh
19
- - -c
20
- - echo hello;sleep 10000
21
- image : alpine
22
- name : alpine2
23
- # resources: {}
9
+ - name : alpine1
10
+ image : alpine:latest
11
+ command : ["/bin/sh", "-c"]
12
+ args :
13
+ - |
14
+ echo "[alpine1] Starting up...";
15
+ sleep 10000;
16
+ resources :
17
+ requests :
18
+ cpu : " 100m"
19
+ memory : " 64Mi"
20
+ limits :
21
+ cpu : " 250m"
22
+ memory : " 128Mi"
23
+ securityContext :
24
+ runAsNonRoot : true
25
+ allowPrivilegeEscalation : false
26
+
27
+ - name : alpine2
28
+ image : alpine:latest
29
+ command : ["/bin/sh", "-c"]
30
+ args :
31
+ - |
32
+ echo "[alpine2] Starting up...";
33
+ sleep 10000;
34
+ resources :
35
+ requests :
36
+ cpu : " 100m"
37
+ memory : " 64Mi"
38
+ limits :
39
+ cpu : " 250m"
40
+ memory : " 128Mi"
41
+ securityContext :
42
+ runAsNonRoot : true
43
+ allowPrivilegeEscalation : false
44
+
24
45
dnsPolicy : ClusterFirst
25
46
restartPolicy : Never
26
- # status: {}
Original file line number Diff line number Diff line change 1
1
apiVersion : v1
2
2
kind : Pod
3
3
metadata :
4
- # creationTimestamp: null
5
- labels :
6
- run : alpine-sa
7
4
name : alpine-sa
5
+ labels :
6
+ app : alpine-sa
8
7
spec :
9
8
serviceAccountName : mysa
10
9
containers :
11
- - args :
12
- - /bin/sh
13
- - -c
14
- - echo hello;sleep 3600
15
- image : alpine
16
- name : alpine-2-containers
17
- # resources: {}
10
+ - name : alpine
11
+ image : alpine:latest
12
+ command : ["/bin/sh", "-c"]
13
+ args :
14
+ - |
15
+ echo "[INFO] Starting container with ServiceAccount: mysa";
16
+ sleep 3600;
17
+ resources :
18
+ limits :
19
+ memory : " 64Mi"
20
+ cpu : " 250m"
21
+ requests :
22
+ memory : " 32Mi"
23
+ cpu : " 100m"
24
+ securityContext :
25
+ runAsNonRoot : true
26
+ allowPrivilegeEscalation : false
18
27
dnsPolicy : ClusterFirst
19
28
restartPolicy : Never
20
- # status: {}
Original file line number Diff line number Diff line change 1
1
apiVersion : v1
2
2
kind : Pod
3
3
metadata :
4
- labels :
5
- run : alpine-2-containers
6
4
name : alpine-2-containers-share-volume
5
+ labels :
6
+ app : alpine-volume-demo
7
7
spec :
8
8
containers :
9
- - args :
10
- - /bin/sh
11
- - -c
12
- - echo hello;sleep 10000
13
- image : alpine
14
- name : alpine1
15
- volumeMounts :
16
- - name : share
17
- mountPath : " /tmp/share1"
18
- - args :
19
- - /bin/sh
20
- - -c
21
- - echo hello;sleep 10000
22
- image : alpine
23
- name : alpine2
24
- volumeMounts :
25
- - name : share
26
- mountPath : " /tmp/share2"
27
- dnsPolicy : ClusterFirst
28
- restartPolicy : Never
9
+ - name : writer
10
+ image : alpine
11
+ command : ["/bin/sh", "-c"]
12
+ args :
13
+ - |
14
+ echo "[Writer] Writing to shared volume...";
15
+ echo "Shared data from writer" > /shared/message.txt;
16
+ echo "[Writer] Sleeping...";
17
+ sleep 10000;
18
+ volumeMounts :
19
+ - name : shared-volume
20
+ mountPath : /shared
21
+
22
+ - name : reader
23
+ image : alpine
24
+ command : ["/bin/sh", "-c"]
25
+ args :
26
+ - |
27
+ echo "[Reader] Waiting for message...";
28
+ sleep 5;
29
+ cat /shared/message.txt || echo "No message found!";
30
+ echo "[Reader] Sleeping...";
31
+ sleep 10000;
32
+ volumeMounts :
33
+ - name : shared-volume
34
+ mountPath : /shared
35
+
29
36
volumes :
30
- - name : share
37
+ - name : shared-volume
31
38
emptyDir : {}
32
- # status: {}
39
+
40
+ dnsPolicy : ClusterFirst
41
+ restartPolicy : Never
Original file line number Diff line number Diff line change 1
1
apiVersion : v1
2
2
kind : Pod
3
3
metadata :
4
- # creationTimestamp: null
5
- labels :
6
- run : alpine-2-containers
7
4
name : alpine-2-containers
5
+ labels :
6
+ app : alpine-2-containers
8
7
spec :
9
8
containers :
10
- - args :
11
- - /bin/sh
12
- - -c
13
- - echo hello;sleep 3600
14
- image : alpine
15
- name : alpine-2-containers
16
- # resources: {}
9
+ - name : alpine
10
+ image : alpine:latest
11
+ command : ["/bin/sh", "-c"]
12
+ args :
13
+ - |
14
+ echo "[alpine] Hello from container";
15
+ sleep 3600;
16
+ resources :
17
+ requests :
18
+ memory : " 32Mi"
19
+ cpu : " 100m"
20
+ limits :
21
+ memory : " 64Mi"
22
+ cpu : " 250m"
23
+ securityContext :
24
+ runAsNonRoot : true
25
+ allowPrivilegeEscalation : false
17
26
dnsPolicy : ClusterFirst
18
27
restartPolicy : Never
19
- # status: {}
You can’t perform that action at this time.
0 commit comments