In Cassandra Lunch #93, Stefan Nikolovski will discuss how to use k8ssandra on Digital Ocean. The live recording of Cassandra Lunch, which includes a more in-depth discussion and a demo, is embedded below in case you were not able to attend live. If you would like to attend Apache Cassandra Lunch live, it is hosted every Wednesday at 12 PM EST. Register here now!
wget https://github.com/digitalocean/doctl/releases/download/v1.71.1/doctl-1.71.1-linux-amd64.tar.gz
tar xf doctl-1.71.1-linux-amd64.tar.gz
sudo mv doctl /usr/local/bin
doctl auth init
kubeconfig
. This provides the kubectl
command with all connection information including TLS certificates and IP addresses for Kube API requests.doctl kubernetes cluster list
doctl kubernetes cluster kubeconfig save k8ssandra
kubectl cluster-info
kubectl version
app=cassandra:NoSchedule
effectively blocking the scheduling of Pods unless they have the taint app=cassandra
. In our example deployment here Cassandra nodes are part of the pool named pool-fmufo1teg
.kubectl get nodes
kubectl taint node -l doks.digitalocean.com/node-pool=pool-fmufo1teg app=cassandra:NoSchedule
medusa_s3_credentials
. The secret will disappear.medusa_s3_credentials.yaml
with content:1apiVersion: v1 2kind: Secret 3metadata: 4 name: prod-k8ssandra-medusa-key 5type: Opaque 6stringData: 7 medusa_s3_credentials: |- 8 [default] 9 aws_access_key_id = REDACTED 10 aws_secret_access_key = REDACTED
kubectl create secret generic prod-k8ssandra-medusa-key --from-file=medusa_s3_credentials=./medusa_s3_credentials.yaml
medusa_s3_credentials
. Any other value will result in Medusa not finding the secret and backups failing.provisioner
, parameters
, and reclaimPolicy
, which are used when a PersistentVolume belonging to the class needs to be dynamically provisioned. The name of a StorageClass object is significant and is how users can request a particular class. Administrators set the name and other parameters of a class when first creating StorageClass objects, and the objects cannot be updated once they are created. Administrators can specify a default StorageClass only for PVCs that don’t request any particular class to bind tovolumeBindingMode: WaitForFirstConsumer
. The default preinstalled do-block-storage
storage class has volumeBindingMode: Immediate
. We will create a new storage class with the required mode based on the existing version.do-block-storage-wait.yaml
with content:1apiVersion: storage.k8s.io/v1 2kind: StorageClass 3metadata: 4 name: do-block-storage-wait 5provisioner: dobs.csi.digitalocean.com 6reclaimPolicy: Delete 7volumeBindingMode: WaitForFirstConsumer 8allowVolumeExpansion: true
kubectl apply -f do-block-storage-wait.yaml
1cassandra: 2 # Version of Apache Cassandra to deploy 3 version: "3.11.10" 4 5 # Configuration for the /var/lib/cassandra mount point 6 cassandraLibDirVolume: 7 storageClass: do-block-storage-wait 8 size: 5Gi 9 10 heap: 11 size: 1G 12 newGenSize: 1G 13 14 resources: 15 requests: 16 cpu: 1000m 17 memory: 2Gi 18 limits: 19 cpu: 1000m 20 memory: 2Gi 21 22 # This key defines the logical topology of your cluster. The rack names and 23 # labels should be updated to reflect the Availability Zones where your GKE 24 # cluster is deployed. 25 datacenters: 26 - name: dc1 27 size: 1 28 racks: 29 - name: rack-a 30 31 32stargate: 33 enabled: true 34 replicas: 1 35 heapMB: 1024 36 cpuReqMillicores: 1000 37 cpuLimMillicores: 1000 38 39medusa: 40 enabled: true 41 storage: s3_compatible 42 storage_properties: 43 host: nyc3.digitaloceanspaces.com 44 port: 443 45 secure: "True" 46 bucketName: k8ssandra-prod-backups 47 storageSecret: prod-k8ssandra-medusa-key
helm install prod-k8ssandra k8ssandra/k8ssandra -f doks.values.yaml
Kubernetes – Kubelet Unable to attach or mount volumes – timed out waiting for the condition – vEducate.co.uk Attaching the PVC to the pods is interrupted so follow this guide if you have the same issue, basically, volumeattachment is not attaching correctly possibly read somewhere about timezone difference but just do this:
kubectl get volumeattachment
kubectl delete volumeattachment <name>
kubectl get pods
kubectl delete pod <name of pod that is in INIT state>
kubectl get secret prod-k8ssandra-superuser -o jsonpath="{.data.username}" | base64 --decode ; echo
kubectl get secret prod-k8ssandra-superuser -o jsonpath="{.data.password}" | base64 --decode ; echo
curl -L -X POST 'http://165.227.248.243:8081/v1/auth' -H 'Content-Type: application/json' --data-raw '{"username": "<k8ssandra-username>", "password": "<k8ssandra-password>"}'
helm uninstall prod-k8ssandra
If you missed Apache Cassandra Lunch #93: K8ssandra on Digital Ocean, it is embedded below! Additionally, all of our live events can be rewatched on our YouTube channel, so be sure to subscribe and turn on your notifications!
Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.
We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!
Subscribe to our monthly newsletter below and never miss the latest Cassandra and data engineering news!