Connect to host from microk8s (eg. Database, Redis Server etc)

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.15.0

Installation method:
Host OS: Ubuntu

What is the preferred method for connecting to services running on the host, outside of microk8s?

In docker for destkop it was: host.docker.internal
In minikube I had to create an endpoint and service.

I’d prefer not to run redis and postgres inside the microk8s cluster, but I can’t seem to find out how to access the host machine from within it. I tried creating a /etc/hosts entry for host.docker.internal and kubedns wouldn’t resolve it.

What’s the right setup for microk8s?

There is no right setup. This issue however was discussed here: https://github.com/ubuntu/microk8s/issues/351#issuecomment-472345118

You could create an interface with sudo ifconfig lo:1 10.0.2.2 up that will not change while your laptop changes IPs and use that IP to reach services running on your machine.