Skip to content

Allow user to configure hostPorts in helm chart #2933

Open
@kate-osborn

Description

@kate-osborn

The containerPorts for the nginx container do not specify hostPorts. The reason we don't specify hostPort by default is because it goes against Kubernetes best practices. From this doc:

Don't specify a hostPort for a Pod unless it is absolutely necessary. When you bind a Pod to a hostPort, it limits the number of places the Pod can be scheduled, because each <hostIP, hostPort, protocol> combination must be unique. If you don't specify the hostIP and protocol explicitly, Kubernetes will use 0.0.0.0 as the default hostIP and TCP as the default protocol.

If you only need access to the port for debugging purposes, you can use the apiserver proxy or kubectl port-forward.

If you explicitly need to expose a Pod's port on the node, consider using a NodePort Service before resorting to hostPort.

However, we can make hostPorts configurable in the helm chart and allow users to enable them if they need them.

This configuration is supported by our ingress controller: https://github.com/nginxinc/kubernetes-ingress/blob/2e0daa1ad6476a5a4801162bcdf6a932534feba0/charts/nginx-ingress/values.yaml#L132

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions