Cassandra inter DC sync over VPN on GCP

3/20/2019

I have an VPN between the company network 172.16.0.0/16 and GCP 10.164.0.0/24

On GCP there is a cassandra cluster running with 3 instances. These instances get dynamical local ip adresses - for example 10.4.7.4 , 10.4.6.5, 10.4.3.4.

My issue: from the company network I cannot access 10.4x addresses as the tunnel works only for 10.164.0.0/24.

I tried setting up an LB service on 10.164.0.100 with the cassandra nodes behind. This doesnt work: when I configure that ip adress as seed node on local cluster, it gets an reply from one of the 10.4.x ip addresses, which it doesnt have in its seed list.

I need advice how to setup inter DC sync in this scenario.

-- Alex Tbk
cassandra
google-cloud-platform
kubernetes

1 Answer

3/20/2019

IP addresses which K8s assign to Pods and Services are internal cluster-only addresses which are not accessible from outside of the cluster. It is possible by some CNI to create connection between in-cluster addresses and external networks, but I don't think that is a good idea in your case.

You need to expose your Cassandra using Service with NodePort or LoadBalancer type. That is another one answer with a same solution from Kubernetes Github.

If you will add a Service with type NodePort, your Cassandra will be available on a selected port on all Kubernetes nodes.

If you will choose LoadBalancer, Kubernetes will create for you Cloud Load Balancer which will be an entrypoint for Cassandra. Because you have a VPN to your VPC, I think you will need an Internal Load Balancer.

-- Anton Kostenko
Source: StackOverflow