Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

nagasree963_193876 avatar image
nagasree963_193876 asked ·

How do I deploy pods to a specific node in Kubernetes?

Is there any option like node affinity such that we can deploy cassandra cluster pods in GCP in a specified node pool. I am using cassandra operator 1.1.0 and cassandra version 3.11.6. Can any one please answer this!

cass-operator
1 comment
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

I'm on the road so I've asked the authors of the cass-operator to respond to your question. Cheers!

0 Likes 0 ·

1 Answer

jim.dickinson_187342 avatar image
jim.dickinson_187342 answered ·

I would strongly recommend you upgrade your cass-operator version. In the latest release, we support passing in a simple nodeSelector as well as supporting nodeAffinity / taints / tolerations. Here's the part of our CRD that documents this a bit - we could use a better example in the repo if you've got a use case we could write up. Could you elaborate on what you want the end result to be?

https://github.com/datastax/cass-operator/blob/4b8163c366155735b6f61af08623bb2edbfdf9ee/charts/cass-operator-chart/templates/customresourcedefinition.yaml#L162

5 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks for replying, We just want to check whether whenever there is a nodepool upgrade, is cassandra pods are moving to another node without data loss. So, just trying out that scenario like deploying cassandra cluster in a specific node-pool, and trying to drain that node to see if those pods are moving to another node without data loss.

Is it possible to deploy cassandra cluster in specific node-pool with cass-operator:1.1.0. if possible tell me the way. Thanks in advance

0 Likes 0 ·

It looks like we added nodeSelector support in v1.1.0, but I believe there are a number of other great reasons you should upgrade.

https://github.com/datastax/cass-operator/commit/3b4720f62b7852e36bff8551c064d920c5e92fe2

We didn't support pushing tolerations down to the pods until v1.2.0, and it was added as part of this very generic customization ability.

https://github.com/datastax/cass-operator/commit/7ce9077beab7fb38f0796c303c9e3a3610d94691

You mentioned you are using GCP - are you using their network persistent disks, or local storage, or something else? GCP persistent disks can move to any other K8s worker node within the same availability zone, so if you're using multiple availability zones you should cass-operator's support to pin Cassandra racks to cloud availability zones.

https://github.com/datastax/cass-operator/blob/v1.1.0/operator/example-cassdc-yaml/dse-6.8.0/example-cassdc-full.yaml#L25


0 Likes 0 ·

Can anyone please update on this

0 Likes 0 ·

I am using the below node and pod affinity options for to deploy cassandra cluster in a specific node pool

```

tolerations:

- key: "dedicated"

operator: "Equal"

value: "gto-operator"

effect: "NoSchedule"

affinity:

nodeAffinity:

requiredDuringSchedulingIgnoredDuringExecution:

nodeSelectorTerms:

- matchExpressions:

- key: node_pool

operator: In

values:

- pool-a

- pool-b

podAntiAffinity:

requiredDuringSchedulingIgnoredDuringExecution:

- labelSelector:

matchLabels:

app.kubernetes.io/name: ####

topologyKey: kubernetes.io/hostname



0 Likes 0 ·

But the pods are deploying into anothe nodepoo pool-n 1. When I do kubectl get po cluster1-dc1-default-sts-0 -o yaml:

spec:

affinity:

podAntiAffinity:

requiredDuringSchedulingIgnoredDuringExecution:

- labelSelector:

matchExpressions:

- key: cassandra.datastax.com/cluster

operator: Exists

- key: cassandra.datastax.com/datacenter

operator: Exists

- key: cassandra.datastax.com/rack

operator: Exists

topologyKey: kubernetes.io/hostname

Is there any option to deploy into a specified namespace

0 Likes 0 ·