In case of External Client, Cluster returns DNS Name of nodes

Hi, I’m testing Couchbase Cluster in Kubernetes

Setting Environment
Couchbase Cluster has 2 nodes with rebalancing…
and I set k8s DNS each nodes by REST API renaming Nodes for auto healing

But the problem is
when I try to use client python SDK through Loadbalancer Service from outside of k8s,
python SDK object “Cluster” has k8s DNS name.
So I want to try to get data from bucket, but SDK can’t not know real ip address and Connection failed.

I know temporary solution ( add dns address in hosts file )
But I think this is not good solution
for example, If a pod died, I need to change hosts file again for new pod address.

Or developing an application for getting IP address by dns… but need time and work

are there some good opinions in this situation?
for example, SDK returns real ip address (not k8s DNS )

In short, it’s very very complicated.

You should use the Operator https://docs.couchbase.com/operator/current/concept-couchbase-networking.html#public-networking-with-external-dns as that can support your requested configuration very easily.

1 Like

Thanks for your reply

That’s what I want that just simple and clear help.
But I think I can not use Operator
Because I am using Community Edition.

So…
One more question…
The reason why I connect to couchbase of container from outside of k8s
is that I need to push data into couchbase by batch processing

Another solution I found…
I think I can use cbimport
cause I did data import through Web Console from outside of k8s
and I found a suggestion using cbimport for faster performance and example command.
is this right?

If it’s possible,
than I will just install couchbase for using cbimport and pushing data.
is it okay?

I’ve just tried above process with cbimport
but I got error like this:
JSON import failed: lookup couchbase-st-0.couchbase.namespace.svc.cluster.local:no such host

I think still need real ip of k8s DNS
so I wonder what it is that success importing data on web console

From when I’ve advised about this before, what I’ve always suggested running cbimport as a pod within Kubernetes. The workflow looks like:

  • Create a container image based on couchbase community edition (with cbimport installed in it)
  • Add your dataset to that container image
  • In Kubernetes, run your image connecting to couchbase://ip-address:8091

That’s the basic version, it gets more complicated (but better) if you want to use DNS based addressing.