title: how to enable port-forward in a k8s service yaml
body: <p>I'm trying to automate a pod deployment and can't seem to figure out how to forward traffic from outside the cluster to the pod from the yaml config.</p>
  
  <p>Access is only possible from localhost but not when accessing the master IP.
  When separately applying 'kubectl port-forward --address 0.0.0.0 POD LISTEN_PORT:DEST_PORT' it works. </p>
  
  <pre><code>apiVersion: v1
  kind: Service
  type:
  metadata:
    labels:
      name: app1
    name: app1
  spec:
    ports:
    - name: "80"
      port: 8888
      targetPort: 80
    selector:
      name: app1
  ---
  apiVersion: v1
  kind: Pod
  metadata:
    labels:
      name: app1
    name: app1
  spec:
    containers:
    - image: nginx
      name: app1
      ports:
      - containerPort: 80
      resources:
        limits:
          cpu: 500m
          memory: "52428800"
        requests:
          cpu: 250m
          memory: "20971520"
    nodeSelector:
      slave: "one"
    restartPolicy: Never
  </code></pre>