Problem connecting to service from pod


#1

I have a simple python container that tries to connect to my operator-provisioned couchbase cluster (Enterprise Edition 5.5.0 build 2958 ‧ IPv4) via the service name. It fails to connect with the following:

kubectl run cbtest -it --image=ssdowd/cbtest:latest --restart=Never  --rm=true --command /app/cbtest.py -- -n 1 -c couchbase://couchbase-550-e.default.svc.cluster.local -b mybucket -u myuser -p mypassword
If you don't see a command prompt, try pressing enter.
Namespace(bucket='mybucket', connection='couchbase://couchbase-550-e.default.svc.cluster.local', count=1, password='mypassword', user='myuser')
Traceback (most recent call last):
  File "/app/cbtest.py", line 56, in <module>
    bucket = cluster.open_bucket(args.bucket)
  File "/usr/local/lib/python2.7/site-packages/couchbase/cluster.py", line 144, in open_bucket
    rv = self.bucket_class(str(connstr), **kwargs)
  File "/usr/local/lib/python2.7/site-packages/couchbase/bucket.py", line 273, in __init__
    self._do_ctor_connect()
  File "/usr/local/lib/python2.7/site-packages/couchbase/bucket.py", line 282, in _do_ctor_connect
    self._connect()
couchbase.exceptions.LCB_0x2D (generated, catch: CouchbaseNetworkError, CouchbaseTransientError): <RC=0x2D[The remote host closed the connection], There was a problem while trying to send/receive your request over the network. This may be a result of a bad network or a misconfigured client or server, C Source=(src/bucket.c,1066)>
pod "cbtest" deleted
pod default/cbtest terminated (Error)

If I try to connect using the internal IP of one of the 3 CB nodes, it works correctly.

Connection code is:

from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator
from couchbase.bucket import Bucket
[...]
cluster = Cluster(args.connection)

if args.password:
    authenticator = PasswordAuthenticator(args.user, args.password)
    cluster.authenticate(authenticator)
    bucket = cluster.open_bucket(args.bucket)

#2

One more data point: if I use http: instead of couchbase: in the connection string it works.

Probably a solution.


#3

It’s a bug, a simple fix and will be available in the 1.0.0 GA released shortly. Thanks for your feedback!