Skip to content

Add monitoring phase for NetworkPolicies: log violations instead of dropping via annotation #2123

Description

@dottorblaster

Is your feature request related to a problem? Please describe.
In the context of the Kubernetes-native network enforcer that me and others are building, we would like to have a monitoring phase for the deployed network policy so the user can verify everything is right before switching to "enforce mode". Policy violations should be logged, but the traffic should still be allowed.

Describe the solution you'd like
From the investigation we conducted:

  • use a custom annotation on the k8s network policy to mark the policy as in "monitor" mode. Not ideal but would avoid a new CRD.
  • if the annotation is present kube-router could change the iptables rules to just log instead of dropping the traffic. This would mean that the notification in monitor mode would be collected through system logs
  • if the annotation is not present the policy is enforced in the cluster.

Describe alternatives you've considered
At first we thought about a dedicated CRD for this, but maybe having just the annotation would be a better fit for the current architecture

Additional context
We already looked into this from a user standpoint: rancher-sandbox/network-enforcer#58

We would still love to hear feedback about anything of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureoverride-staleDon't allow automatic management of stale issues / PRs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions