Skip to content

Missing permission in the managed podSecurityPolicy to authorize the pod to bind port 9092 in hostNetwork mode #365

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

Closed
mvisonneau opened this issue Feb 15, 2021 · 3 comments
Labels
good first issue Good for newcomers Type: Enhancement New feature or request

Comments

@mvisonneau
Copy link
Contributor

When attempting to use enablePrometheusServer: true in conjunction with rbac.pspEnabled: true and useHostNetwork: true. It looks like there is some missing parameter in the PodSecurityPolicy to authorize the pod to bind TCP/9092.

Warning  FailedCreate      69s (x9 over 3m54s)    daemonset-controller  Error creating: pods "aws-node-termination-handler-" is forbidden: unable to validate against any pod security policy: [spec.securityContext.hostNetwork: Invalid value: true: Host network is not allowed to be used spec.volumes[0]: Invalid value: "hostPath": hostPath volumes are not allowed to be used spec.containers[0].hostPort: Invalid value: 9092: Host port 9092 is not allowed to be used. Allowed ports: [] spec.containers[0].hostPort: Invalid value: 9092: Host port 9092 is not allowed to be used. Allowed ports: []]
@haugenj
Copy link
Contributor

haugenj commented Feb 17, 2021

How did you install NTH? I've just tried reproducing this on a cluster of mine and haven't had any errors.

If you edit the pod security policy and add the following is there any difference?

hostPorts:
  - min: 9092
    max: 9092

If that fixes your issue we can change the yaml template

@haugenj haugenj added the good first issue Good for newcomers label Feb 17, 2021
@mvisonneau
Copy link
Contributor Author

👋 hey @haugenj, absolutely this is exactly what I did and it sorts the issue out 👍

I can submit a PR with the change if you want me to, I just did not take the time to do it sorry about that! 😅

@haugenj
Copy link
Contributor

haugenj commented Feb 18, 2021

Yeah if you could write it that'd be awesome! If you can use Mustache to dynamically get the value of the Prometheus port and only include it if Prometheus is enabled I think that would be best. Thanks!

mvisonneau added a commit to mvisonneau/aws-node-termination-handler that referenced this issue Feb 21, 2021
When metric/prometheus endpoint is enabled, we currently have an issue as the
PodSecurityPolicy does not allow the pod to bind the ports. This change sorts
this issue out (aws#365).
mvisonneau added a commit to mvisonneau/aws-node-termination-handler that referenced this issue Feb 21, 2021
When metric/prometheus endpoint is enabled, we currently have an issue as the
PodSecurityPolicy does not allow the pod to bind the ports. This change sorts
this issue out (aws#365).

Signed-off-by: Maxime VISONNEAU <[email protected]>
haugenj pushed a commit that referenced this issue Feb 23, 2021
When metric/prometheus endpoint is enabled, we currently have an issue as the
PodSecurityPolicy does not allow the pod to bind the ports. This change sorts
this issue out (#365).

Signed-off-by: Maxime VISONNEAU <[email protected]>
@haugenj haugenj added Pending-Release Pending an NTH or eks-charts release and removed Status: Work in Progress labels Feb 23, 2021
haugenj pushed a commit to haugenj/aws-node-termination-handler that referenced this issue Mar 1, 2021
When metric/prometheus endpoint is enabled, we currently have an issue as the
PodSecurityPolicy does not allow the pod to bind the ports. This change sorts
this issue out (aws#365).

Signed-off-by: Maxime VISONNEAU <[email protected]>
@haugenj haugenj closed this as completed Mar 2, 2021
@snay2 snay2 removed the Pending-Release Pending an NTH or eks-charts release label Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants