<p>I deploy an ingress with <code>app1</code> and <code>app2</code>.</p>

<pre><code>example.com/app1  ---&gt; app1
example.com/app2  ---&gt; app2
</code></pre>

<p>And define /etc/hosts in all the machine.</p>

<pre><code>192.168.1.10    example.com
</code></pre>

<p>But i want to know in operation how can i use <strong>DNS</strong> and ingress.</p>

<p>What should i do?
What ingress bring to me?
I confused by ingress. How should i use it in practical envinroment?</p>

yasin lachini
<p>With DNS you can't just use <code>example.com</code> (<code>example.com</code> is owned by <a href="https://www.iana.org/" rel="noreferrer">IANA</a>). You have to own the DNS configured on your ingress. For example:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: simple-fanout-example
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: mydomain.com
    http:
      paths:
      - path: /foo
        backend:
          serviceName: service1
          servicePort: 4200
</code></pre>

<p>In the case above you have to own <code>mydomain.com</code>. You can buy your domain at any major <a href="https://en.wikipedia.org/wiki/Domain_name_registrar" rel="noreferrer">domain registrar</a> like <a href="https://www.godaddy.com" rel="noreferrer">GoDaddy</a>.</p>

<p>Then you will have to expose your Ingress externally depending on the setup you have (AWS, bare-metal, etc) with a <a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/" rel="noreferrer">LoadBalancer</a> Kubernetes Service and have an <a href="https://en.wikipedia.org/wiki/List_of_DNS_record_types" rel="noreferrer">A, or CNAME</a> entry on your domain registrar manager, point to that external endpoint (for <code>mydomain.com</code>). For example, on AWS that entry would be a CNAME that looks like this: <code>xxxxx-xxxxxxxxxxxx.us-west-2.elb.amazonaws.com</code></p>

<p>Note: You can ignore the host altogether but the ingress will only service a default backend as described <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource" rel="noreferrer">here</a> with a minimal ingress resource. As far as using your own DNS server, just you can too, as long as your DNS server correctly resolves mydomain.com to the external IP that your ingress controller is fronting.</p>

<p>Hope it helps!</p>
