<p>Trying to make a bare metal k8s cluster to provide some services and need to be able to provide them on tcp port 80 and udp port 69 (accessible from outside the k8s cluster.) I've set the cluster up using kubeadm and it's running ubuntu 16.04. How do I access the services externally? I've been trying to use load-balancers and ingress but am having no luck since I'm not using an external load balancer (Local rather than AWS etc.)</p>

<p>An example of what I'm trying to do can be found <a href="https://www.safaribooksonline.com/library/view/getting-started-with/9781787283367/eb506133-083b-4708-9f92-1f56ddbfff56.xhtml" rel="nofollow noreferrer">here</a> but it's using GCE.</p>

<p>Thanks</p>

<h1>Service with NodePort</h1>

<p>Create a service with type <a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport" rel="nofollow noreferrer"><code>NodePort</code></a>, Service can be listening TCP/UDP port 30000-32767 on every node. By default, you can not simply choose to expose a Service on port 80 on your nodes. </p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
  - protocol: TCP
    port: {SERVICE_PORT}
    targetPort: {POD_PORT}
    nodePort: 31000
  - portocol: UDP
    port: {SERVICE_PORT}
    targetPort: {POD_PORT}
    nodePort: 32000
  type: NodePort
</code></pre>

<p>The container image <a href="https://github.com/kubernetes/contrib/tree/master/for-demos/proxy-to-service" rel="nofollow noreferrer"><code>gcr.io/google_containers/proxy-to-service:v2</code></a> is a very small container that will do port-forwarding for you. You can use it to forward a pod port or a host port to a service. Pods can choose any port or host port, and are not limited in the same way Services are.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: dns-proxy
spec:
  containers:
  - name: proxy-udp
    image: gcr.io/google_containers/proxy-to-service:v2
    args: [ "udp", "53", "kube-dns.default", "1" ]
    ports:
    - name: udp
      protocol: UDP
      containerPort: 53
      hostPort: 53
  - name: proxy-tcp
    image: gcr.io/google_containers/proxy-to-service:v2
    args: [ "tcp", "53", "kube-dns.default" ]
    ports:
    - name: tcp
      protocol: TCP
      containerPort: 53
      hostPort: 53
</code></pre>

<h1>Ingress</h1>

<p>If there are multiple services sharing same TCP port with different hosts/paths, deploy the <a href="https://github.com/kubernetes/ingress-nginx/" rel="nofollow noreferrer">NGINX Ingress Controller</a>, which listening on HTTP 80 and HTTPS 443.</p>

<p>Create an ingress, forward the traffic to specified services.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        backend:
          serviceName: test
          servicePort: 80
</code></pre>
