-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose cassandra nodes to outside of Kubernetes cluster #1144
Comments
Hi, this is one of our weak spots. Either your pod IPs are routable outside of Kubernetes and then this is not a problem as the clients can access all Cassandra pods directly, or you have a connectivity problem due to how the driver behaves (with its auto discovery feature). @olim7t, wdyt? Reaper itself will run from within the k8s cluster and doesn't need to go through the nodeport. |
Hi @adejanovski, NodePort:
is not only using nodeport with target port 9042, but it changes the native port used by cassandra to 30002.
All the kubernetes services are changed, and these ports are used:
That's the reason why reaper does not work. The service used by reaper in my case is cassandra-dc1-service and it does not expose 9042 port when nodePort is set. Another approach (without nodeport):
I created SVC for each node of type LoadBalancer and external-dns annotation to get new external IPs generated for each node.
That setup works perfect as nodes are broadcasting external IPs, but cass-operator is not able to update the CassandraDatacenter status.
and then it search for that IP in url=/api/v0/metadata/endpoints field RPC_ADDRESS
If findHostIdForIpFromEndpointsData would use INTERNAL_IP and not RPC_ADDRESS, that check would work.
Would it be possible to use INTERNAL_IP in findHostIdForIpFromEndpointsData instead of RPC_ADDRESS? Thanks! |
I have the exact same problem. Did you find another way to achieve what you wanted ? Another workaround ? |
What did you do?
I have cassandra client running outside of kubernetes cluster.
I've tried to use:
But then reaper keeps trying to connect on port 9042 and I do not see any way to set up the custom port for reaper.
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra-dc1-service/xx.xx.xx.xx:9042 Cannot connect)
Did you expect to see some different?
Environment
K8ssandra Operator version:
cr.k8ssandra.io/k8ssandra/k8ssandra-operator:v1.10.3
* Kubernetes version information:v1.27
* Kubernetes cluster kind:```gcp
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
name: cassandra
spec:
cassandra:
datacenters:
- config:
cassandraYaml:
...
jvmOptions:
gc: G1GC
heapSize: 512M
jmxInitContainerImage:
name: debian
registry: docker.io
tag: stable
metadata:
name: dc1
resources:
limits:
cpu: 1
memory: 10Gi
requests:
cpu: 100m
memory: 512M
size: 3
softPodAntiAffinity: true
stopped: false
storageConfig:
cassandraDataVolumeClaimSpec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
serverType: cassandra
serverVersion: 3.11.7
reaper:
ServiceAccountName: default
containerImage:
name: cassandra-reaper
registry: docker.io
repository: thelastpickle
tag: 3.4.0
deploymentMode: PER_DC
heapSize: 2Gi
httpManagement:
enabled: false
initContainerImage:
name: cassandra-reaper
registry: docker.io
repository: thelastpickle
tag: 3.4.0
keyspace: reaper_db
secretsProvider: internal
2023-12-19 11:53:40 - INFO - New Cassandra host <Host: xx.xx.xx.xx:30002 dc1> discovered
2023-12-19 11:53:40 - DEBUG - Handling new host <Host: xx.xx.xx.xx:30002 dc1> and notifying listeners
2023-12-19 11:53:40 - DEBUG - Done preparing queries for new host <Host: xx.xx.xx.xx:30002 dc1>
2023-12-19 11:53:40 - DEBUG - Host xx.xx.xx.xx:30002 is now marked up
The text was updated successfully, but these errors were encountered: