You cannot expose your Kubernetes cluster like you've tried.
I strongly advise to use a different Kubernetes solution as minikube
is more a tool to experiment and develop as said in the official site:
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.
Kubernetes.io: Learning environment: Minikube
Please take a look on other solutions like:
You have several things to remember when trying to expose Kubernetes to the Internet from your private network.
- Access to public IP
- Ability to port forward traffic inside your network
- Allow traffic to your
minikube
instance
- Combining all of the above
Why do I think it's minikube
instance?
You have 2 network interfaces:
This interfaces are getting created when you run your minikube
with Virtualbox
Access to public IP
Access to public IP is crucial. Without it you will not be able to expose your services to the Internet. There are some exclusions but I will not focus on them here.
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 94.XXX.XXX.XXX
.
You can read more about differences between public and private ip addresses here:
Ability to port forward traffic inside your network
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. If they are blocked you will be unable to expose your services. To expose your services to the Internet you will need to use "port-forwarding".
You can read more about it here:
Allow traffic to your minikube
instance
As I previously mentioned: When you create your minikube
instance with Virtualbox you will create below network interfaces:
NAT
- interface which will allow your VM to access the Internet. This connection cannot be used to expose your services
Host-only-network-adapter
- 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.
You can read more about Virtualbox networking here:
I've managed to find a workaround to allow connections outside your laptop/pc to your minikube
instance. You will need to change network interface in settings of your minikube
instance from Host-only-network-adapter
to Bridged Adapter
(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. Minikube
should change IP address to match the one used in your physical one.
You will also need to change your .kube/config
as it will have the old/wrong IP address!
After that you should be able to connect to your Ingress
resource by IP accessible in your physical network.
Combining all of the above
Remembering the information above, let's assume.
- You have a public IP address associated on the WAN interface of your router (for example
94.100.100.100
).
- You create a
A
record in DNS pointing to your domain name to 94.100.100.100
.
- You create a port-forwarding from port
80
to port 80
to the IP address of minikube
bridged adapter.
After that you should be able to connect from outside to your Ingress
resource.
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 minikube
instance.