<p>I have a web service running on a port on my local network exposed at port 6003. I also have a Kubernetes Cluster running on a different machine on the same network that uses and Nginx Ingress to proxy to all the services in the cluster. How can I set up an ingress to proxy to the machine? I had a set up that worked. But now, I am either getting DNS errors on the nginx pod or the response times out in the browser and nothing happens. </p>

<p>Here is the manifest I have been using.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: myservice-service
spec:
  type: ExternalName
  externalName: 192.xxx.xx.x
ports:
  - name: myservice
    port: 80
    protocol: TCP
    targetPort: 6003
---
apiVersion: v1
kind: Endpoints
metadata:
  name: myservice-ip
subsets:
  - addresses:
      # list all external ips for this service
      - ip: 192.xxx.xx.x
    ports:
      - name: myservice
        port: 6003
        protocol: TCP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: service.example.com
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: service.example.com
      http:
        paths:
          - backend:
              serviceName: myservice-service
              servicePort: 80
            path: /
  tls:
    - secretName: secret-prod-tls
      hosts:
        - service.example.com
</code></pre>

<p><strong>Edit for more information:</strong>
This manifest does work. What I realized is that you <strong>must</strong> specify https even though the ingress has a tls block. This still is showing Lua DNS errors in the Nginx-ingress pod though.</p>

James Teague II
<p>You don't need ExternalName here. Usual headless service will do the job:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: external-ip
spec:
  ports:
  - name: http
    port: 80
  clusterIP: None
  type: ClusterIP
---
apiVersion: v1
kind: Endpoints
metadata:
  name: external-ip
subsets:
- addresses:
  - ip: 172.17.0.5
  ports:
  - name: http
    port: 80
</code></pre>
