-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow configuration of namespaces watched for secrets #3154
Comments
@hafe I think I am starting to understand what you are attempting to do with the proposed extra command line option. You have this ingress controller project. And you have that restricted to watching a list of namespaces. However, in your case you also have additional artifacts that you don't want the controller process to enumerate. Specifically, secrets. Essentially your RBAC logic is: "watch the relative things in these namespaces except the secrets". The reason that I am asking for clarification is that we are trying to fully understand the use case behind an additional flag, and not simply adding an additional secrets namespace to the list of watched namespaces. If all of that is true, what is your business requirement is behind having secrets in the application space that are somehow not related? I am guessing there is some business requirement behind what your organization is doing that we are not fully understanding. Also, if you could help me understand this statement:
|
Correct. List (unfortunately) means read with K8s RBAC.
Well kind of. I found the blog post, especially the "Restricted Self-Service" model but also cross-namespace-configuration. In that setup, an Ingress (master) or VirtualServer together with secrets are created in e.g. the controller namespace. An Ingress (minion) and/or VirtualServerRoute are located in application namespaces. With this separation, there is no need for the ingress controller to read secrets in the application namespace. It only needs to protected with RBAC since the controller still needs to list/read secrets. Otherwise it will never become ready!
Using an additional secrets namespace is not possible since Ingress, Secret, Service and POD needs to be in the same namespace. I believe the same is true for VirtualServer. The use case of the new additional flag is to support RBAC for the "Restricted Self-Service" model .
Just security requirements. Considering that the ingress controller is usually Internet facing, it should not have access to secrets not needed.
I just realised that there could other ways of implementing the same thing. Just found it more complex to start reading annotations/labels from namespaces and settled with a new command line option. But again the ideal solution is for the ingress controller to only watch secrets actually referenced from Ingress & VirtualServer but that seems a lot harder to implement. |
In doing a bit of additional searching and reading... I thought this was a useful description of combinations: it would require some type of namespace/name pattern to refer to a secret, as opposed to simply name. That would be a fundamental behavior change specific to secrets enumeration. |
I read that get+watch does not work. Meaning that solution might not be possible to implement. My patch is just supporting hardened rbac for the "cross namespace" configuration. Which effectively achieves the same level of security, in a different way. |
We have come to detail your use case in the following way (to help folks understand - as you are taking the RBAC model to a different level of granularity):
|
Add new command line option "watch-secret-namespace" that can be used to configure namespaces watched for secrets. Closes nginx#3154
* Watch subset of namespaces for secrets Add new command line option "watch-secret-namespace" that can be used to configure namespaces watched for secrets. Closes #3154 * Apply suggestions from code review Co-authored-by: Ciara Stacke <[email protected]> * Update cmd/nginx-ingress/flags.go Co-authored-by: Ciara Stacke <[email protected]>
* Watch subset of namespaces for secrets Add new command line option "watch-secret-namespace" that can be used to configure namespaces watched for secrets. Closes nginx#3154 * Apply suggestions from code review Co-authored-by: Ciara Stacke <[email protected]> * Update cmd/nginx-ingress/flags.go Co-authored-by: Ciara Stacke <[email protected]>
Is your feature request related to a problem? Please describe.
Either all (by default) or a subset (new 2.4 feature) of namespaces are watched for ingress related resources BUT ALSO SECRETS..
This means all found secrets are cached in the ingress controller even if not needed/used. This of course is a security concern.
With multi tenancy and namespace isolation as described by:
"Enabling Multi-Tenancy and Namespace Isolation in Kubernetes with NGINX - NGINX" https://www.nginx.com/blog/enabling-multi-tenancy-namespace-isolation-in-kubernetes-with-nginx/
There is no requirement/need for the controller to read secrets from the application namespaces.
Thus security can be improved by allowing to configure what namespaces should be watched for secrets.
Using custom RBAC roles and bindings the cluster admin can fine tune the controller privileges to the minimum for it to work.
Describe the solution you'd like
One possible and simple solution is to provide an additional flag similar to "watch-namespace" but for secrets. Let's call it "watch-secret-namespaces".
For this I have a patch I will submit for review.
Describe alternatives you've considered
Other implementations are more complex using for example annotations/labels on namespaces
Additional context
The text was updated successfully, but these errors were encountered: