Skip to content
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

fix: container has runAsNonRoot and image will run as root #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ spec:
containers:
- name: manager
securityContext:
runAsUser: 65534
readOnlyRootFilesystem: true
runAsNonRoot: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not the right fix. We shouldn't need to run the image as root.

Instead add:

     runAsUser: 65534

Copy link
Member Author

@googs1025 googs1025 Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning Failed 76s (x7 over 2m25s) kubelet Error: container has runAsNonRoot and image will run as root (pod: "nfd-controller-manager-6658568db5-2fdrm_node-feature-discovery-operator(869ad52b-d4ae-4314-a69b-4d7faa8148da)", container: manager)
I made the change based on the error, which is a bit weird. Ok, I will try this approach this weekend. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP. The default user in the image is root (uid 0), not great choice by itself. You can override that with runAsUser

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

seccompProfile:
type: RuntimeDefault
allowPrivilegeEscalation: false
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/nfd-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 10