<p>I have created a Kubernetes cluster on my virtual machine and I have been trying to expose this to Internet with my own domain(for eg, <a href="http://www.mydomain.xyz" rel="nofollow noreferrer">www.mydomain.xyz</a>). I have created an ingress resource as below and I've also modified kubelet configuration to have my domain name. All my pods and services are created in this domain name (Eg, default.svc.mydomain.xyz)</p>
<pre><code>root@master-1:~# kubectl get ingress
NAME           CLASS    HOSTS                  ADDRESS        PORTS   AGE
test-ingress   &lt;none&gt;   www.mydomain.xyz   192.168.5.11   80      5d20h

root@master-1:~# kubectl get svc -n ingress-nginx
NAME                                 TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.103.59.116   192.168.5.11   443:30740/TCP,80:31894/TCP   6d21h

</code></pre>
<p>I tried to add A record in my domain DNS page as below and could not add it.</p>
<p><a href="https://i.stack.imgur.com/2XEFs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2XEFs.png" alt="enter image description here" /></a></p>
<p>This is where I get stuck and unable to proceed further.  Do I need to change anything in the cluster to add this namespace in &quot;Domain DNS configuration&quot; (Hostinger) or anything to be added in master node.</p>
<p>How does the domain that I own redirect all the traffic to my kubernetes cluster?</p>
<p>Any help would be highly appreciated.</p>

<p><strong>You cannot expose your Kubernetes cluster like you've tried.</strong></p>
<p>I strongly advise to use a different Kubernetes solution as <code>minikube</code> is more a tool to experiment and develop as said in the official site:</p>
<blockquote>
<p>Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.</p>
<p><em><a href="https://kubernetes.io/docs/setup/learning-environment/minikube/" rel="noreferrer">Kubernetes.io: Learning environment: Minikube </a></em></p>
</blockquote>
<p>Please take a look on other solutions like:</p>
<ul>
<li><a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/" rel="noreferrer">Kubernetes.io: Production environment: Create cluster kubeadm</a></li>
<li><a href="https://github.com/kubernetes-sigs/kubespray" rel="noreferrer">Github.com: Kubespray</a></li>
<li><a href="https://cloud.google.com/kubernetes-engine" rel="noreferrer">Cloud.google.com: Kubernetes Engine</a></li>
<li><a href="https://aws.amazon.com/eks/" rel="noreferrer">Aws.amazon.com: EKS</a></li>
</ul>
<hr />
<p>You have several things to remember when trying to expose Kubernetes to the Internet from your private network.</p>
<ul>
<li>Access to public IP</li>
<li>Ability to port forward traffic inside your network</li>
<li>Allow traffic to your <code>minikube</code> instance</li>
<li>Combining all of the above</li>
</ul>
<blockquote>
<p><em>Why do I think it's <code>minikube</code> instance?</em></p>
<p>You have 2 network interfaces:</p>
<ul>
<li><code>NAT</code></li>
<li><code>Host-only</code></li>
</ul>
<p>This interfaces are getting created when you run your <code>minikube</code> with Virtualbox</p>
</blockquote>
<h3>Access to public IP</h3>
<p>Access to public IP is crucial. <strong>Without it you will not be able to expose your services to the Internet.</strong> There are some exclusions but I will not focus on them here.</p>
<p>In the DNS panel you've entered the private IP address. You cannot do that unless the DNS server is intended resolve only local queries (your private network). To allow other users to connect to your Kubernetes cluster you need to provide a public IP address
like <code>94.XXX.XXX.XXX</code>.</p>
<p>You can read more about differences between public and private ip addresses here:</p>
<ul>
<li><a href="https://help.keenetic.com/hc/en-us/articles/213965789-What-is-the-difference-between-a-public-and-private-IP-address-" rel="noreferrer">Help.keenetic.com: What is the difference between a public and private IP address</a></li>
</ul>
<h3>Ability to port forward traffic inside your network</h3>
<p>If you have your public IP you will also need to check if the incoming connections are not blocked by other devices like ISP's firewalls or your router. <strong>If they are blocked you will be unable to expose your services.</strong> To expose your services to the Internet you will need to use &quot;port-forwarding&quot;.</p>
<p>You can read more about it here:</p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Port_forwarding" rel="noreferrer">Wikipedia.org: Port forwarding</a></li>
</ul>
<h3>Allow traffic to your <code>minikube</code> instance</h3>
<p>As I previously mentioned: When you create your <code>minikube</code> instance with Virtualbox you will create below network interfaces:</p>
<ul>
<li><code>NAT</code>-  interface which will allow your VM to access the Internet. This connection cannot be used to expose your services</li>
<li><code>Host-only-network-adapter</code> - interface created by your host which allows to communicate within the interface. It means that your host and other vm's with this particular adapter could connect with each other. It's designed for internal usage.</li>
</ul>
<p>You can read more about Virtualbox networking here:</p>
<ul>
<li><a href="https://www.virtualbox.org/manual/ch06.html" rel="noreferrer">Virtualbox.org: Virtual Networking</a></li>
</ul>
<p>I've managed to find a <strong>workaround</strong> to allow connections outside your laptop/pc to your <code>minikube</code> instance. You will need to change network interface in settings of your <code>minikube</code> instance from  <strong><code>Host-only-network-adapter</code></strong> to <strong><code>Bridged Adapter</code></strong> (2nd adapter). This will work as another device was connected to your physical network. Please make sure that this bridged adapter is used with Ethernet NIC. <code>Minikube</code> should change IP address to match the one used in your physical one.</p>
<blockquote>
<p>You will also need to change your <code>.kube/config</code> as it will have the old/wrong IP address!</p>
</blockquote>
<p>After that you should be able to connect to your <code>Ingress</code> resource by IP accessible in your physical network.</p>
<hr />
<h3>Combining all of the above</h3>
<p>Remembering the information above, let's assume.</p>
<ul>
<li>You have a public IP address associated on the WAN interface of your router (for example <code>94.100.100.100</code>).</li>
<li>You create a <code>A</code> record in DNS pointing to your domain name to <code>94.100.100.100</code>.</li>
<li>You create a port-forwarding from port <code>80</code> to port <code>80 </code>to the IP address of <code>minikube</code> bridged adapter.</li>
</ul>
<p>After that you should be able to connect from outside to your <code>Ingress</code> resource.</p>
<p>The request will first contact DNS server for IP address associated with the domain. Then it will send request to this IP address (which is presumably your router). Your router will port-forward this connection to your <code>minikube</code> instance.</p>
