# 拓扑感知提示 TopologyAwareHints (opens new window)
TopologyAwareHints 实验 https://blog.csdn.net/shida_csdn/article/details/124285905
参考了别人的实验,自己也做了,确实有用,但要注意
前提
node 带有以下label会被ignore
node-role.kubernetes.io/control-plane
node-role.kubernetes.io/master
apiVersion: v1
kind: Service
metadata:
annotations:
service.kubernetes.io/topology-aware-hints: auto
name: nginx
namespace: default
spec:
selector:
app: nginx
type: NodePort
ports:
- name: nginx
protocol: TCP
port: 80
targetPort: http
nodePort: 31200
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: default
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
# affinity:
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - topologyKey: topology.kubernetes.io/zone
containers:
- name: nginx
image: nginx
ports:
- name: http
containerPort: 80
protocol: TCP
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 100m
memory: 100Mi
livenessProbe:
httpGet:
port: http
path: /
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
periodSeconds: 10
readinessProbe:
httpGet:
port: http
path: /
timeoutSeconds: 2
successThreshold: 1
failureThreshold: 3
periodSeconds: 10
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69