-
Notifications
You must be signed in to change notification settings - Fork 813
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
Improve securityContext implementation #1333
Conversation
|
Hi @ConnorJC3. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold should also migrate the new defaults over to the kustomize configuration if they pass CI, also needs helm changelog |
/ok-to-test |
Thank you @ConnorJC3! |
/unhold made CI happy, ready for review |
@@ -104,6 +106,10 @@ spec: | |||
resources: | |||
{{- toYaml . | nindent 12 }} | |||
{{- end }} | |||
{{- with .Values.node.containerSecurityContext }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for feedback: Was wondering if this should default to the ebs-plugin
security context if not supplied, similar to how resources does (look a few lines up).
/lgtm
|
/remove-hold |
As @torredil mentioned, the |
We should also consider |
@torredil added to both. I don't think it will matter that much for the node as we already have to run as root there. Decided to leave out the default I asked about for now because it wouldn't be obvious which config to default from (the controller or the node?) |
Implement securityContext for containers Add securityContext for node pod Utilize more secure defaults for securityContext Improve `make generate-kustomize` to filter out namespace and tags
@torredil @bertinatto @wongma7 can you please take a look? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ConnorJC3, torredil The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@torredil @bertinatto @wongma7 can someone approve running workflows? |
/lgtm |
@pierluigilenoci Sorry for the delay on this. As a best practice, we strive for more than one review before merging changes. @olemarkus Thanks for taking a look. |
@torredil nothing to be sorry about. Thanks a lot to everyone. |
Is this a bug fix or adding new feature?
New feature
Fixes #1332
Fixes #1101
What is this PR about? / Why do we need it?
Implements
securityContext
for the node pod and all containers (including sidecar containers). Also switches to a more securesecurityContext
default of running as a non-root user and with a read-only root filesystem.Currently, the node pod must run as a root user because
/var/lib/kubelet/plugins/ebs.csi.aws.com/
and/var/lib/kubelet/plugins_registry/
are kubelet-managed and usually only writable by root (additionally, the node driver needsprivileged
for the bidirectional mount anyways, so root would not give extra security to that container anyways).Also makes some minor improvements to
make generate-kustomize
so it doesn't generate useless diffs that have to be manually removed.What testing is done?
Manually tested.