kube-vip-cloud-provider: specify unprivileged securityContext #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Further to #46 , specify additional securityContext fields that allow kvcp to run fully unprivileged. This is required to run on clusters that enforce Pod Security Standards.
The Dockerfile shows that kvcp is intended to run as the "nonroot" user, but there is no UID specified:
https://github.com/kube-vip/kube-vip-cloud-provider/blob/main/Dockerfile#L24
In this case I think kubernetes may leave it up to the container runtime to figure out what UID to use. I'm not sure what the actual behaviour would be, but in any case it is better to be explicit.
I checked the container image:
This confirms that the intended UID and GID of the "nonroot" account that kvcp should run as are 65532.
This also removes capabilities, which AFAICT kvcp does not need. It would have only had ones provided by default by whichever container runtime is used. Again this would result in inconsistent behaviour depending on implementation/deployment details and it is preferable to be explicit instead.