Skip to content

Commit df68b8d

Browse files
authored
alertmanager/networkPolicy: Allow cluster peer-to-peer communication
Signed-off-by: GitHub <[email protected]>
1 parent 233a8ac commit df68b8d

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

jsonnet/kube-prometheus/components/alertmanager.libsonnet

+31-12
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,38 @@ function(params) {
113113
},
114114
policyTypes: ['Egress', 'Ingress'],
115115
egress: [{}],
116-
ingress: [{
117-
from: [{
118-
podSelector: {
119-
matchLabels: {
120-
'app.kubernetes.io/name': 'prometheus',
116+
ingress: [
117+
{
118+
from: [{
119+
podSelector: {
120+
matchLabels: {
121+
'app.kubernetes.io/name': 'prometheus',
122+
},
121123
},
122-
},
123-
}],
124-
ports: std.map(function(o) {
125-
port: o.port,
126-
protocol: 'TCP',
127-
}, am.service.spec.ports),
128-
}],
124+
}],
125+
ports: std.map(function(o) {
126+
port: o.port,
127+
protocol: 'TCP',
128+
}, am.service.spec.ports),
129+
},
130+
// Alertmanager cluster peer-to-peer communication
131+
{
132+
from: [{
133+
podSelector: {
134+
matchLabels: {
135+
'app.kubernetes.io/name': 'alertmanager',
136+
},
137+
},
138+
}],
139+
ports: [{
140+
port: 9094,
141+
protocol: 'TCP',
142+
}, {
143+
port: 9094,
144+
protocol: 'UDP',
145+
}],
146+
},
147+
],
129148
},
130149
},
131150

manifests/alertmanager-networkPolicy.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ spec:
2222
protocol: TCP
2323
- port: 8080
2424
protocol: TCP
25+
- from:
26+
- podSelector:
27+
matchLabels:
28+
app.kubernetes.io/name: alertmanager
29+
ports:
30+
- port: 9094
31+
protocol: TCP
32+
- port: 9094
33+
protocol: UDP
2534
podSelector:
2635
matchLabels:
2736
app.kubernetes.io/component: alert-router

0 commit comments

Comments
 (0)