Skip to content

Commit 9f61e04

Browse files
committed
chapter8: Update deployment configurations for timeserver and add network-utils deployment
1 parent eb85af3 commit 9f61e04

File tree

11 files changed

+88
-28
lines changed

11 files changed

+88
-28
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
scratch
2+
.idea
3+
/out
4+
*.iml

Chapter07/7.1_InternalServices/deploy.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: timeserver
55
spec:
6-
replicas: 4
6+
replicas: 2
77
selector:
88
matchLabels:
99
pod: timeserver-pod
@@ -12,6 +12,8 @@ spec:
1212
labels:
1313
pod: timeserver-pod
1414
spec:
15+
nodeSelector:
16+
minikube.k8s.io/name: minikube-m02
1517
containers:
1618
- name: timeserver-container
1719
image: timeserver-java:5

Chapter08/8.1.1_NodeSelection/deploy_nodeaffinity.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: timeserver
55
spec:
6-
replicas: 1
6+
replicas: 3
77
selector:
88
matchLabels:
99
pod: timeserver-pod
@@ -23,4 +23,17 @@ spec:
2323
- arm64
2424
containers:
2525
- name: timeserver-container
26-
image: docker.io/wdenniss/timeserver:5
26+
image: timeserver-java:6
27+
resources:
28+
requests:
29+
cpu: 200m
30+
memory: 250Mi
31+
limits:
32+
cpu: 300m
33+
memory: 400Mi
34+
env:
35+
- name: KUBERNETES_POD_NAME
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.name
39+

Chapter08/8.1.1_NodeSelection/deploy_nodeselector.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: timeserver
55
spec:
6-
replicas: 1
6+
replicas: 3
77
selector:
88
matchLabels:
99
pod: timeserver-pod
@@ -12,8 +12,20 @@ spec:
1212
labels:
1313
pod: timeserver-pod
1414
spec:
15-
nodeSelector:
16-
kubernetes.io/arch: arm64
15+
# nodeSelector:
16+
# two.pages/type: lucky
1717
containers:
1818
- name: timeserver-container
19-
image: docker.io/wdenniss/timeserver:5
19+
image: timeserver-java:5
20+
resources:
21+
requests:
22+
cpu: 200m
23+
memory: 250Mi
24+
limits:
25+
cpu: 300m
26+
memory: 400Mi
27+
env:
28+
- name: KUBERNETES_POD_NAME
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: metadata.name

Chapter08/8.1.2_NodeAffinity/deploy_nodeaffinity_multi.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,4 @@ spec:
2424
- amd64
2525
containers:
2626
- name: timeserver-container
27-
image: docker.io/wdenniss/timeserver:5
28-
resources:
29-
requests:
30-
cpu: 500m
27+
image: timeserver-java:5

Chapter08/8.1.2_NodeAffinity/deploy_nodeaffinity_preferred.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: timeserver
55
spec:
6-
replicas: 6
6+
replicas: 3
77
selector:
88
matchLabels:
99
pod: timeserver-pod
@@ -24,7 +24,4 @@ spec:
2424
- arm64
2525
containers:
2626
- name: timeserver-container
27-
image: docker.io/wdenniss/timeserver:5
28-
resources:
29-
requests:
30-
cpu: 500m
27+
image: timeserver-java:5

Chapter08/8.1.3_Taints/deploy_tolerate_spot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ spec:
1717
value: "true"
1818
containers:
1919
- name: timeserver-container
20-
image: docker.io/wdenniss/timeserver:5
20+
image: timeserver-java:5

Chapter08/8.2.1_TopologySpread/deploy_topology.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: timeserver
55
spec:
6-
replicas: 3
6+
replicas: 2
77
selector:
88
matchLabels:
99
pod: timeserver-pod
@@ -12,17 +12,20 @@ spec:
1212
labels:
1313
pod: timeserver-pod
1414
spec:
15-
topologySpreadConstraints:
16-
- maxSkew: 1
17-
topologyKey: kubernetes.io/hostname
18-
whenUnsatisfiable: ScheduleAnyway
19-
labelSelector:
20-
matchLabels:
21-
pod: timeserver-pod
15+
nodeSelector:
16+
kubernetes.io/hostname: minikube-m02
2217
containers:
2318
- name: timeserver-container
24-
image: docker.io/wdenniss/timeserver:5
19+
image: timeserver-java:5
2520
resources:
2621
requests:
2722
cpu: 200m
2823
memory: 250Mi
24+
limits:
25+
cpu: 300m
26+
memory: 400Mi
27+
env:
28+
- name: KUBERNETES_POD_NAME
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: metadata.name
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: network-utils
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: network-utils
10+
template:
11+
metadata:
12+
labels:
13+
app: network-utils
14+
spec:
15+
affinity:
16+
podAffinity:
17+
requiredDuringSchedulingIgnoredDuringExecution:
18+
- labelSelector:
19+
matchExpressions:
20+
- key: pod
21+
operator: In
22+
values:
23+
- timeserver-pod
24+
topologyKey: kubernetes.io/hostname
25+
containers:
26+
- name: network-utils
27+
image: amouat/network-utils
28+
command: ["/bin/bash"]
29+
tty: true
30+
stdin: true
31+
env:
32+
- name: TIMESERVER_ENDPOINT
33+
value: http://timeserver:8080

Chapter08/8.2.2_Colocation/frontend.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
spec:
1515
containers:
1616
- name: timeserver-container
17-
image: docker.io/wdenniss/timeserver:5
17+
image: timeserver-java:5
1818
affinity:
1919
podAffinity:
2020
requiredDuringSchedulingIgnoredDuringExecution:

0 commit comments

Comments
 (0)