Skip to content

Commit 566d3bf

Browse files
authored
Kubernetes: fix global network policy (#1235)
global network policy was misconfigured so that it allowed all traffic. By setting correct value structure this is fixed. Proper global network policy discovered a wrong RUT network policy that was correctly adjusted. Bonus: * Imrpove calico network policy debug documentation Related issue/s * #1226
1 parent f483df3 commit 566d3bf

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

charts/calico-configuration/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ if calico version 3.30+ is installed
1515

1616
if calico version <= 3.29
1717
* create network policy with action log (read more https://docs.tigera.io/calico/latest/network-policy/policy-rules/log-rules)
18+
* WARNING: these logs are shown in journalctl **of the node where restricted workload (POD / Container) is running**
1819
```yaml
1920
apiVersion: projectcalico.org/v3
2021
kind: NetworkPolicy

charts/calico-configuration/templates/globalpolicy.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ spec:
2626
# IP from https://github.com/kubernetes-sigs/kubespray/blob/v2.24.1/roles/kubespray-defaults/defaults/main/main.yml#L108
2727
- action: Allow
2828
protocol: UDP
29-
nets:
30-
- 169.254.25.10/32
31-
ports:
32-
- 53
29+
destination:
30+
nets:
31+
- 169.254.25.10/32
32+
ports:
33+
- 53
3334
- action: Allow
3435
protocol: TCP
3536
destination:
@@ -38,7 +39,8 @@ spec:
3839
- 53
3940
- action: Allow
4041
protocol: TCP
41-
nets:
42-
- 169.254.25.10/32
43-
ports:
44-
- 53
42+
destination:
43+
nets:
44+
- 169.254.25.10/32
45+
ports:
46+
- 53

charts/simcore-charts/resource-usage-tracker/templates/networkpolicy.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ spec:
2525
- action: Allow
2626
protocol: TCP
2727
destination:
28-
nets:
29-
- 10.0.0.0/8
30-
- 192.168.0.0/16
31-
- 172.16.0.0/12
28+
# currently public IPs are used
29+
# nets:
30+
# - 10.0.0.0/8
31+
# - 192.168.0.0/16
32+
# - 172.16.0.0/12
3233
ports:
3334
- {{ .Values.networkPolicyEgressPorts.redis }}
3435
- action: Allow
3536
protocol: TCP
3637
destination:
37-
nets:
38-
- 10.0.0.0/8
39-
- 192.168.0.0/16
40-
- 172.16.0.0/12
38+
# currently public IPs are used
39+
# nets:
40+
# - 10.0.0.0/8
41+
# - 192.168.0.0/16
42+
# - 172.16.0.0/12
4143
ports:
4244
- {{ .Values.networkPolicyEgressPorts.rabbit }}

0 commit comments

Comments
 (0)