<p>I have this <code>NodePort</code> service that exposes two ports:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: my-service
  ports:
  - name: nginx-public
    port: 443
    targetPort: nginx-public
  - name: metrics
    port: 9200
    targetPort: metrics
</code></pre>

<p>The <code>nginx-public</code> port has to be exposed on the node because I'm using it with aws-alb-ingress-controller.</p>

<p>However, the other port for <code>metrics</code> is only used internally (from within the cluster) - it's picked up by prometheus-operator. I need to have it documented in the service spec, but I'd rather not reserve another port on the Node at the same time.</p>

<p>Is there a way to tell Kubernetes to only reserve one node port for this service?</p>

<p>I tried specifying <code>nodePort: null</code> in the port spec like this:</p>

<pre><code>  ports:
  - name: nginx-public
    port: 443
    targetPort: nginx-public
  - name: metrics
    port: 9200
    targetPort: metrics
    nodePort: null
</code></pre>

<p>but according to <code>describe service</code>, seems like this has the same effect as omitting <code>nodePort</code> altogether, and a random port is still being reserved for <code>metrics</code>.</p>

<p>you can define two services one selects nginx-public and the other selects metrics. use two 
 different labels on the pods respectively.</p>
