Accessing couchbase running locally, from an app running in minikube

I have an app running in minikube, the couchbase server running locally, and I would like to be able to access couchbase, without having to run couchbase in minikube. How can I do this?

With great difficulty :smiley: However provided you know your networking it’s probably possible:

On the host

ip route add 10.0.0.0/8 via 172.17.0.3

where the IP prefix is the pod network and the address is the IP address of the minikube VM/container.

In minikube

ip route add 192.16.8.0.0/24 via 172.17.0.1

where the IP prefix is the subnet your laptop (?) lives on, and the IP address is the bridge the minikube VM/container is attached to.

That all sets up bidirectional routing. In general, you should be able to ping the app from outside, and ping the cluster from inside using IP addresses. Note all my numbers are semi made up, you’ll need to derive them for your own environment.

Finally, as Couchbase nodes are advertised to the app as for example couchbase-0, you’ll need to “hack” the /etc/hosts files on the minikube nodes and manually add in entries that correspond to your Couchbase nodes so the app can see them e.g.

192.168.0.5 couchbase-0
192.168.0.6 couchbase-1
192.168.0.7 couchbase-2

Then you should be able to connect as http://couchbase-0 from the app.


Or the far easier thing to do is just run the Couchbase Operator Introduction | Couchbase Docs in Kubernetes as well.

Minikube also has some docs on accessing internal applications: Accessing apps | minikube

This will depend on your configuration of course. Simon’s approach above is probably the best although only for dev of course.

There are some other alternatives using the network driver configuration and other components, e.g. https://stackoverflow.com/a/66419813

I went through these suggestions. I need for my Java app running in kubernetes to be able to access Couchbase. So, I need to make the Couchbase server visible inside of Kubernetes.