I was able to narrow down my problem to the following case:
I'm creating Kubernetes pod with two containers:
My app's code is as follows (full content of main function):
CouchbaseEnvironment ce = DefaultCouchbaseEnvironment.builder()
.connectTimeout(10000)
.build();
CouchbaseCluster cluster = CouchbaseCluster.create(ce, "127.0.0.1");
Bucket bucket = cluster.openBucket("my_user", "some_pass");
JsonObject jo = JsonObject.empty();
jo.put("SomeName", "someValue");
bucket.upsert(JsonDocument.create("my_id", jo));
It fails on last command with timeout:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:93)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:267)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:262)
at CConfig.main(CConfig.java:19)
... 6 more
Caused by: java.util.concurrent.TimeoutException
... 10 more
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 1 more
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:93)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:267)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:262)
at CConfig.main(CConfig.java:19)
... 6 more
Caused by: java.util.concurrent.TimeoutException
... 10 more
I don't know how to fix this or get to the root cause as timeout is very unlikely as the Couchbase is having only one, empty bucket.
PS when configured logs for Couchbase client I was able to see keep-alive entries working just fine.
I'm using official Couchbase java client in version 2.1.0. Also tried 2.1.6 and 2.2.5 but no luck.
The problem was created by me - the bucket I have created didn't had password set and I tried to connect to it with password...
I wanted to delete whole answer but I thought that it might be helpful in case someone else have similar problem