Upgrade K8ssandra
You can easily upgrade your K8ssandra cluster. In this topic, we’ll describe how to:
- Update an existing K8ssandra repo to the latest release
- Take action based on an upgrade consideration for K8ssandra 1.1.0
- Upgrade from the single-node Cassandra instance to a 3-node Cassandra instance, as an example
Introduction
Upgrading a K8ssandra instance is a multi-step process:
- Use
helm repo updateto ensure your Kubernetes cluster is using the latest K8ssandra software. - Follow the steps for any upgrade considerations, as is the case when going from K8ssandra 1.0.0 to 1.1.0.
- Update or create a configuration YAML file with the changes you want to apply the cluster.
- Apply the changes using the
helm upgradecommand.
An assumption here is that you previously installed K8ssandra, with a command such as:
helm repo add k8ssandra https://helm.k8ssandra.io/stable/
Update the K8ssandra repo
To update your installed version of K8ssandra, enter:
helm repo update
Output:
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "k8ssandra" chart repository
Update Complete. ⎈Happy Helming!⎈
For example, because K8ssandra released 1.1.0 on 09-Apr-2021, the helm repo update command automatically gets the latest software.
Upgrade notice for K8ssandra 1.4.x
Upgrading from K8ssandra 1.0.x to 1.4.x causes a StatefulSet update, which has the effect of a rolling restart. This situation could require you to perform a manual restart of all Stargate nodes after the Cassandra cluster is back online.
To manually restart Stargate nodes:
- Get the Deployment object in your Kubernetes environment:
kubectl get deployment | grep stargate - Scale down with this command:
kubectl scale deployment <stargate-deployment> --replicas 0 - Run this next command and wait until it reports 0/0 ready replicas. This should happen within a couple seconds.
kubectl get deployment <stargate-deployment> - Now scale up with:
kubectl scale deployment <stargate-deployment> --replicas 1
Upgrade example with node scaling
To upgrade your single-node instance to a 3-node instance:
-
Create a new
k8ssandra-upgrade.yamlfile with the following configuration fragment:cassandra: datacenters: - name: dc1 size: 3The cluster size has increased from
1to3Tip
You only need the YAML statements pertinent to the upgrade. You don’t need to duplicate the entire original configuration file. -
Upgrade the cluster using the
helm upgradecommand:helm upgrade -f k8ssandra-upgrade.yaml k8ssandra k8ssandra/k8ssandraOutput:
Release "k8ssandra" has been upgraded. Happy Helming! NAME: k8ssandra LAST DEPLOYED: Mon Apr 12 11:17:37 2021 NAMESPACE: default STATUS: deployed REVISION: 2Notice that the REVISION is now at
2. It will increment each time you run ahelm upgradecommand.
Tip
For insights into the underlying operations that occur with scaling, see Scale your Cassandra cluster.-
Monitor
kubectl get podsuntil the new Cassandra nodes are up and running:kubectl get podsOutput:
NAME READY STATUS RESTARTS AGE k8ssandra-cass-operator-6666588dc5-qpvzg 1/1 Running 4 2d2h k8ssandra-dc1-default-sts-0 2/2 Running 0 76m k8ssandra-dc1-default-sts-1 2/2 Running 0 3m29s k8ssandra-dc1-default-sts-2 2/2 Running 0 3m28s k8ssandra-dc1-stargate-6f7f5d6fd6-sblt8 1/1 Running 13 2d2h k8ssandra-grafana-6c4f6577d8-hsbf7 2/2 Running 0 3m32s k8ssandra-kube-prometheus-operator-5556885bd6-st4fp 1/1 Running 4 2d2h k8ssandra-reaper-k8ssandra-5b6cc959b7-zzlzr 1/1 Running 22 2d2h k8ssandra-reaper-k8ssandra-schema-47qzk 0/1 Completed 0 2d2h k8ssandra-reaper-operator-cc46fd5f4-85mk5 1/1 Running 5 2d2h prometheus-k8ssandra-kube-prometheus-prometheus-0 2/2 Running 9 2d2hEventually you should see two additional K8ssandra pods with the extensions
-sts-1and-sts-2inRUNNINGstatus.
Next steps
Explore other K8ssandra tasks.
See the Reference topics for information about K8ssandra Helm charts, and a glossary.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.