title: Difference between targetPort and port in Kubernetes Service definition
body: <p>A Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noreferrer"><code>Service</code></a> can have a <code>targetPort</code> and <code>port</code> in the service definition:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>kind: Service
  apiVersion: v1
  metadata:
    name: my-service
  spec:
    selector:
      app: MyApp
    ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
  </code></pre>
  
  <p>What is the difference between the <code>port</code> and <code>targetPort</code>?</p>