You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* create network policy with action log (read more https://docs.tigera.io/calico/latest/network-policy/policy-rules/log-rules)
18
+
```yaml
19
+
apiVersion: projectcalico.org/v3
20
+
kind: NetworkPolicy
21
+
metadata:
22
+
name: log ingress requests
23
+
spec:
24
+
selector: app == 'db'
25
+
ingress:
26
+
- action: Log
27
+
```
28
+
* apply policy and see logs via journalctl (you can grep with `calico-packet` on the node where the pod is running)
29
+
* Note: one may implement policy step by step (allowing all traffic that is known and making last rule `Log` to see what traffic is still missing)
30
+
31
+
## Known issues
32
+
33
+
If network policy is created after pod, pod **MUST** be restarted for policy to take effect. Read more https://github.com/projectcalico/calico/issues/10753#issuecomment-3140717418
34
+
* To automate this, we can add annotations with network policy checksum to pods (see https://stackoverflow.com/questions/58602311/will-helm-upgrade-restart-pods-even-if-they-are-not-affected-by-upgrade)
35
+
36
+
## How to view existing policies
37
+
38
+
via kubectl:
39
+
* `kubectl get networkpolicies.crd.projectcalico.org -n adminer`
0 commit comments