Host network is not allowed to be used spec.containers[0].securityContext.hostNetwork

I ran into a problem.
When I deployed the ingress-controller deployment on my kubernetes, the pod was created with hostNetwork=true enabled to listen on port 80 of the host. But can't create, prompt error:
message: 'pods "nginx-ingress-controller-7885cc9b4b-" 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.containers[0].securityContext.hostNetwork: Invalid value: true: Host network is not allowed to be used spec.containers[0].securityContext.containers[0].hostPort: Invalid value: 80: Host port 80 is not allowed to be used. Allowed ports: [] spec.containers[0].securityContext.containers[0].hostPort: Invalid value: 443: Host port 443 is not allowed to be used. Allowed ports: []]'

image

Edited Jul 07, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading