<p>I basically want to access the Nginx-hello page externally by URL. I've made a (working) A-record for a subdomain to my v-server running kubernetes and Nginx ingress: vps.my-domain.com</p>

<p>I installed Kubernetes via kubeadm on CoreOS as a single-node cluster using these tutorials: <a href="https://kubernetes.io/docs/setup/independent/install-kubeadm/" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/independent/install-kubeadm/</a>, <a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="nofollow noreferrer">https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/</a>, and nginx-ingress using <a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal</a>.</p>

<p>I also added the following entry to the /etc/hosts file:</p>

<pre><code>31.214.xxx.xxx vps.my-domain.com
</code></pre>

<p>(xxx was replaced with the last three digits of the server IP)</p>

<p>I used the following file to create the deployment, service, and ingress:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - name: http
          containerPort: 80
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  type: ClusterIP
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  selector:
    run: my-nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-nginx
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/ssl-redirect: "False"
spec:
  rules:
  - host: vps.my-domain.com
    http:
      paths:
      - backend:
          serviceName: my-nginx
          servicePort: 80
</code></pre>

<p>Output of describe ing:</p>

<pre><code>core@vps ~/k8 $ kubectl describe ing
Name:             my-nginx
Namespace:        default
Address:
Default backend:  default-http-backend:80 (&lt;none&gt;)
Rules:
  Host                  Path  Backends
  ----                  ----  --------
  vps.my-domain.com
                           my-nginx:80 (&lt;none&gt;)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration:      
{"apiVersion":"extensions/v1beta1",...}

  kubernetes.io/ingress.class:         nginx
  ingress.kubernetes.io/ssl-redirect:  False
Events:
  Type    Reason  Age                From                      Message
  ----    ------  ----               ----                      -------
  Normal  UPDATE  49m (x2 over 56m)  nginx-ingress-controller  Ingress default/my-nginx
</code></pre>

<p>While I can curl the Nginx hello page using the nodeip and port 80 it doesn't work from outside the VM. <code>Failed to connect to vps.my-domain.com port 80: Connection refused</code></p>

<p>Did I forgot something or is the configuration just wrong? Any help or tips would be appreciated! </p>

<p>Thank you</p>

<p><strong>EDIT:</strong></p>

<p>Visiting "vps.my-domain.com:30519` gives me the nginx welcome page. But in the config I specified port :80.
I got the port from the output of get services:</p>

<pre><code>core@vps ~/k8 $ kubectl get services --all-namespaces | grep "my-nginx"
default         my-nginx               ClusterIP   10.107.5.14      &lt;none&gt;        80/TCP                       1h
</code></pre>

<p>I also got it to work on port :80 by adding   </p>

<pre><code>externalIPs:
  - 31.214.xxx.xxx
</code></pre>

<p>to the my-nginx service. But this is not how it's supposed to work, right? In the tutorials and examples for kubernetes and ingress-nginx, it worked always without externalIPs. Also the ingress rules doesn't work now (e.g. if I set the path to /test).</p>

michidk
<p>So apparently I was missing one part: the load balancer. I'm not sure why this wasn't mentioned in those instructions as a requirement. But i followed this tutorial: <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#a-pure-software-solution-metallb" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#a-pure-software-solution-metallb</a> and now everything works. </p>

<p>Since metallb requires multiple ip addresses, you have to list your single ip-adress with the subnet \32: <code>31.214.xxx.xxx\32</code></p>
