-
Notifications
You must be signed in to change notification settings - Fork 1.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
please support more parts of securityContext #7924
Comments
Hey @FWiesner thanks for the issue Just to capture more context can you comment on how you plan on using these fields? For example:
|
Hey @dprotaso here's my scenario When you have shared volumes and those volumes need to be accessed by multiple different services in read/write mode, you would normally want to make sure that proper file system permissions are automatically enforced. An example could be a volume to write application audit trails. When that volume gets mounted, you would then want to tell the service about the groupId that has access to this shared volume, say groupId 7000. That it would be 7000 you don't necessarily know when you delivered the image. On that volume you might want to have directories that belong to different groups and different users. In this case you'd set In our specific case we ask our teams to not give use ready to use KSVC descriptors, but just |
Sorta related question: At this time Knative OSS only supports configmap, secret & projected volumes. Are you circumventing that? |
This is our use case: For function that runs inside EKS that needs to access various AWS resources such as S3 bucket, we want to create separate K8s However, when we run the docker image using non-root user, we ran into permission issue ( aws/amazon-eks-pod-identity-webhook#8) . There is a document in AWS that explain how to use However, Knative does not allow This is a blocker for us. Running docker image as a root user is against best practice and risky. |
Looking at PodSecurityContext, the following fields seem "harmless":
I'm also wondering if the AWS webhook mentioned in #7924 (comment) should be setting I'm leery of adding the following, as they seem to drive through privilege escalation as well as additional constraint:
|
so: I don't know how much we care, but technically I think this opens up some new security surface area. For example, if we allow Again, it's not clear to me that there are actually any real users in such a situation so I can see an argument for just allowing this, but: I personally feel quite conservative about exposing fields with security implications - even ones that are very likely ok - without a major version bump or a feature flag defaulting the other way. |
https://github.com/knative/serving/blob/master/docs/runtime-contract.md#user There's a conformance test for it here: serving/test/conformance/runtime/user_test.go Lines 35 to 37 in fcba769
|
For enforcement that covers multiple products I'd expect cluster operators to use admission webhooks as a gate. I think the use case we're missing is taking off the self products and running them on your cluster - these images may have a poorer security posture and thus you may want to set the following properties to ensure they are not running as root
|
Talked to @julz offline - we'll add this feature but gate it behind a feature flag in the short term. Long term we'll want to sort out a few things
|
We are still running into the same issue after upgrading to Knative 0.17 ‘’’Error from server (BadRequest): error when creating "servicenew.yaml": admission webhook "webhook.serving.knative.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field "fsGroup"’’’ Any advice? Thank you |
You'll need to set the feature flag here to serving/config/core/configmaps/features.yaml Lines 71 to 93 in 3432804
|
@dprotaso thank you for your quick response. We did a kubectl edit configmap in knative-serving NS on the running Knative env but still get the same error. Is there a way to check if that flag is active ? Do we need to something else? |
Are you modifying the text I linked? That's under an You need to copy it to under serving/config/core/configmaps/features.yaml Lines 24 to 25 in 3432804
|
That was it. It is working now. Thank you for pointing that out. |
@dprotaso Does the following change affect Istio once changed to "allowed"? Can you help us to understand what are the side-effects once enabled? And any security concerns? Thanks
|
The flag doesn't enable the entire pod security context but just the following properties
So the side-effect of I think the answer to your question depends on the trust between the platform team and app dev teams. ie. if the app dev team can directly create pods and set those properties then there's no difference setting them on a Knative Service Ultimately if you're looking to set only a single property and not expose that to app-teams then you'd probably want a custom webhook |
In what area(s)?
/area API
Describe the feature
https://knative.dev/docs/serving/spec/knative-api-specification-1.0/ allows you using
runAsUser
from the containers'securityContext
, but none of the other fields.When running Knative services have to access shared volumes, this is not enough. When your shared volumes rely on proper group membership, then
runAsGroup
andfsGroup
would be required as well. I don't know whether you have a specific reason not to support these fields (runAsNonRoot
would be another candidate), but we would really love to see support for those extended aspects ofsecurityContext
The text was updated successfully, but these errors were encountered: