Question

How to allow managed load balancers in kubernetes network policies?

I want to restrict access to namespaces. I’ve added next network policy to my namespace:

kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: np-dev-allow
  namespace: dev
spec:
  podSelector: {}
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          purpose: monitoring
    - namespaceSelector:
        matchLabels:
          purpose: ci
    - namespaceSelector:
        matchLabels:
          environmentName: dev

In this policy I’m only allowing traffic from few namespaces. But after that DO load balancer is down and can’t reach nodes, load balancer created by nginx-ingress. How I can whitelist load balancer in network policies?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer