<p>I built my own 1 host kubernetes cluster (1 host, 1 node, many namespaces, many pods and services) on a virtual machine, running on a always-on server.</p>

<p>The applications running on the cluster are working fine (basically, a NodeJS backend and HTML frontend).
So far, I have a NodePort Service, which is exposing Port 30000:</p>

<pre><code>NAME                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
traefik-ingress-service   NodePort    10.109.211.16    &lt;none&gt;        443:30000/TCP            147d
</code></pre>

<p>So, now I can access the web interface by typing <code>https://&lt;server-alias&gt;:30000</code> in my browser adress bar.</p>

<p>But I would like to access it without giving the port, by only typing <code>https://&lt;server-alias&gt;</code>.
I know, this can be done with the kubectl port-forwarding command:
<code>kubectl -n kube-system port-forward --address 0.0.0.0 svc/traefik-ingress-service 443:443</code></p>

<p>This works. But it does not seem to be a very professional thing to do.</p>

<p>Port forwarding also seems to keep disconnecting from time to time. Sometimes, it throws an error and quits, but leaves the process open, which leaves the port open - have to kill the process manually.</p>

<p>So, is there a way to do that access-my-application stuff professionally? How do the cluster provider (AWS, GCP...) do that?</p>

<p>Thank you!</p>

<p>Using Ingress Nginx you can access to you website with the name server:</p>

<ol>
<li>Step 1: Install Nginx ingress in you cluster you can flow this <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">link</a></li>
</ol>

<p>After the installation is completed you will have a new pod </p>

<pre><code>NAME                                    READY   STATUS

nginx-ingress-xxxxx                     1/1     Running
</code></pre>

<p>And a new Service </p>

<pre><code>NAME                             TYPE           CLUSTER-IP     EXTERNAL-IP
nginx-ingress                    LoadBalancer   10.109.x.y     a.b.c.d
</code></pre>

<ol start="2">
<li><p>Step 2 : Create new deployment for you application but <strong>be sure that you are using the same name space for nginx ingress svc/pod and you application</strong> and you set the svc type to <strong>ClusterIP</strong></p></li>
<li><p>Step 3: Create Kubernetes Ingress Object</p></li>
</ol>

<p>Now you have to  create the ingress object </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: **Same Name Space**
spec:
  rules:
  - host: your DNS  &lt;server-alias&gt;
    http:
      paths:
      - backend:
          serviceName: svc Name
          servicePort: svc Port
</code></pre>

<p>Now you can access to your website using the .</p>

<p>To create a DNS for free you can use <a href="https://my.freenom.com" rel="nofollow noreferrer">freenom</a> or you can use /etc/hosts 
update it with :</p>

<pre><code>server-alias a.b.c.d
</code></pre>
