-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use a NetworkPolicy instead of kube-rbac-proxy #1885
Comments
I loved 👍 The only possible con here is check how if it would work nicely on other vendors such as OCP. Did you check that already? |
|
Hi @estroz, I raised this concern because in the past I remember some problems to work with So, since Kubebuilder as SDK needs to support previous k8s cluster versions we would also need to check if we would need to allow scaffold it by using networking.k8s.io/v1beta1 as well |
Network policies are implemented by CNI(container Network Interface) in the cluster. It means the users which are deploying kubebuilder's operator on such cluster where CNI doesn't support the Network Policy (For example: Flannel) this restriction policy will not work there. This con also needs to be considered while implementing this. |
Right, and this potentially makes NetworkPolicy scaffolding (by default at least) a non-starter since it locks projects out of certain CNI's. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Also, regards the motivations
Then, see the motivation for this project: https://github.com/brancz/kube-rbac-proxy/#motivation
Then, see that the auth-proxy was built to:
However, I also align with the pros of using NetworkPolicy (remove thrid-party and reduce the deps). But we might want to better analyse and discuss this one. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Good argumentations to move forward within this one:
More info: #1885 (comment) |
Another good reason, and a potential deadline, gcr.io container-registry is deprecated and is scheduled to be moved to Artifact Registry on May 15, 2024. https://cloud.google.com/container-registry/docs/deprecations/container-registry-deprecation |
Since we have enough positive responses to move forward with this approach, I'm going to add this to the agenda for our next community meeting. Meanwhile, if anyone would like to take this up and contribute, please feel free to assign yourself. |
I'm interested! |
On the other hand, AWS VPC CNI does't support NetworkPolicy. There are a lot of kubernetes users that use EKS and have no choice but to use that CNI driver. |
Sorry to bring some negative perspectives but to me NetworkPolicy and kube-rbac-proxy, although both security related, do not address the same use case:
In practice it means that you can control with kube-rbac-proxy, which user or serviceaccount has access whereas you can control with networkpolicy, which network segment has access. Both may be useful but not interchangeable. |
Thanks for bring that up, after some reading, I agree. Is it worth providing or documenting a NetworkPolicy with information similar to the above or do we think that we shouldn't pursue this issue any further? |
The other option as @camilamacedo86 mentioned in the community meeting is to build a plugin that adds the scaffolding to this to the main gaoling plugin. This will also reduce the burden of us not building the kube-rbac-proxy image again (since its not a part of k8s project: https://github.com/brancz/kube-rbac-proxy), as we could accept a user provided image to be added to the project. |
We can also consider using this feature from controller-runtime 0.16.0 kubernetes-sigs/controller-runtime#2407 which I think perfectly fits our use-case of locking down the metrics endpoint with K8s RBAC without kube-rbac-proxy |
I do prefer this approach and will start work in this direction:
but with regards to this:
I noticed that AWS VPC CNI now supports NetworkPolicy! https://aws.amazon.com/blogs/containers/amazon-vpc-cni-now-supports-kubernetes-network-policies/ |
Hi @mjlshen Your help is very required if you are interested in this one. If you be unable to help us out, it will be sad but please remove the assign to you so maybe others can try to check this one. Thank you a lot for all your help. 🥇 |
Next Step: Evaluate NetworkPolicy IntegrationExpected Outcome:
Goals:
We need to create such as markdown table factor | using NetwrokPolices | using auth-proxy | using Controller Runtime | . So that we can evaluate the 3 options raised. Steps: Review comments to capture NetworkPolicy's benefits and drawbacks. b) Create PR with Scaffold Changes:
c) Community Discussion: Share PR results in Kubebuilder channel so that we can collect feedback and insights as decide whether to merge the PR or retain rbac-proxy. Your help here is very appreciated by the whole community 🥇 |
Is supporting NetworkPolicy a requirement for CNI, or is it just an option? If it's optional, should we be requiring it? |
Hi @mjlshen, You wrote above:
That might be an option. Regards controller runtime
See: #1885 (comment) |
kube-rbac-proxy, while a nice feature, is a third-party workaround for a problem (restricting pod access to
/metrics
) that can be solved by aNetworkPolicy
. For example, the following policy could be scaffolded by default so only manager-related pods could be selected:Benefits:
/kind feature
The text was updated successfully, but these errors were encountered: