title: Why don't my Kubernetes services publish on the port I specify?
body: <p>I've been tinkering with Kubernetes on and off for the past few years and I am not sure if this has always been the case (maybe this behavior changed recently) but I cannot seem to get Services to publish on the ports I intend - they always publish on a high random port (>30000).</p>
  
  <p>For instance, I'm going through <a href="https://hackernoon.com/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45" rel="nofollow noreferrer">this walkthrough on Ingress</a> and I create the following Deployment and Service objects per the instructions:</p>
  
  <pre><code>---
  apiVersion: apps/v1beta1
  kind: Deployment
  metadata: 
    name: hello-world-deployment
  spec: 
    replicas: 1
    template: 
      metadata: 
        labels: 
          app: hello-world
      spec: 
        containers: 
          - image: "gokul93/hello-world:latest"
            imagePullPolicy: Always
            name: hello-world-container
            ports: 
              - containerPort: 8080
  ---
  apiVersion: v1
  kind: Service
  metadata: 
    name: hello-world-svc
  spec: 
    ports: 
       -  port: 9376
          protocol: TCP
          targetPort: 8080
    selector: 
      app: hello-world
    type: NodePort
  </code></pre>
  
  <p>According to this, I should have a Service that's listening on port 8080, but instead it's a high, random port:</p>
  
  <pre><code>~$ kubectl describe svc hello-world-svc
  
  Name:                     hello-world-svc
  Namespace:                default
  Labels:                   &lt;none&gt;
  Annotations:              &lt;none&gt;
  Selector:                 app=hello-world
  Type:                     NodePort
  IP:                       10.109.24.16
  Port:                     &lt;unset&gt;  8080/TCP
  TargetPort:               8080/TCP
  NodePort:                 &lt;unset&gt;  31669/TCP
  Endpoints:                10.40.0.4:8080
  Session Affinity:         None
  External Traffic Policy:  Cluster
  Events:                   &lt;none&gt;
  </code></pre>
  
  <p>I also verified that none of my nodes are listening on 8080, but they are listening on 31669.</p>
  
  <p>This isn't super ideal - especially considering that the Ingress portion will need to know what <code>servicePort</code> is being used (the walkthrough references this at 8080).</p>
  
  <p>By the way, when I create the Ingress controller, this behavior is the same - rather than listening on 80 and 443 like a good load balancer, it's listening on high random ports.</p>
  
  <p>Am I missing something? Am I doing it all wrong?</p>