In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to deploy K8ssandra to Kubernetes on Linux". In daily operation, I believe many people have doubts about how to deploy K8ssandra to Kubernetes on Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to deploy K8ssandra to Kubernetes on Linux"! Next, please follow the editor to study!
Catalogue
1 what is K8ssandra
2 install K8ssandra
2.1 install Kubenetes
2.2 install helm3
2.3 install K8ssandra with Helm
2.4 add nodes
3 View Monitoring
4 Summary
1 what is K8ssandra
Cassandra is a very excellent open source distributed NoSQL database, which is adopted by many excellent large companies. It has the characteristics of high availability, flexible expansion, good performance and so on.
Due to the advantages of Cassandra, we often need to use cloud services, so we need to deploy Cassandra to K8s, so we have K8ssandra. K8ssandra not only helps us deploy Cassandra on Kubernetes quickly and reliably, but also provides many components, such as monitoring, backup, synchronization, access, and so on. And these are indispensable to a Production-Ready product.
The component architecture diagram of K8ssandra is as follows:
Cass-operator: ensure the normal operation of the whole cluster
Reaper: a synchronization tool to ensure consistency
Medusa: a data backup tool that supports S3, GCP Cloud Storage, etc.
Stargate: provides API for data access
Prometheus+Grafana: a common monitoring component native to the cloud.
2 install K8ssandra2.1 install Kubenetes
How to build Kubernetes on Ubuntu has been described in detail in the article "how to build a Kubernetes cluster in VirtualBox+Ubuntu16", which will not be discussed here. For better compatibility, we specify the version of Kubernetes with the following command:
Minikube start-driver=none-kubernetes-version=v1.19.13
Because we are going to use PVC, we create a StorageClass:
$kubectl apply-f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml2.2 install helm3
We need to use Helm to deploy K8ssandra. Download Helm3 as follows:
# download the installation package curl-LO https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz#, extract tar-zxvf helm-v3.7.0-linux-amd64.tar.gz# and move to the bin directory mv linux-amd64/helm / usr/local/bin/helm
Add Helm's warehouse:
Helm repo add k8ssandra https://helm.k8ssandra.io/stable$ helm repo listNAME URL k8ssandra https://helm.k8ssandra.io/stabletraefik https://helm.traefik.io/traefik
Look for K8ssandra-related packages:
$helm search repo k8ssandraNAME CHART VERSION APP VERSION DESCRIPTION k8ssandra/k8ssandra 1.3.1 Provisions and configures an instance of the en...k8ssandra/k8ssandra-common 0.28.4 Helper library containing functions used by man...k8ssandra/k8ssandra -operator 0.31.0 1.0.0 Kubernetes operator which handles the provision...k8ssandra/backup 0.26.0 Creates a CassandraBackup custom resource insta...k8ssandra/cass-operator 0.31.0 1.8.0 Kubernetes operator which handles the provision...k8ssandra/medusa-operator 0.30.1 0.1.0 Installs and configures the Medusa Operator for...k8ssandra/reaper-operator 0.32.1 0.1.0 Configures and installs the Reaper Operator for...k8ssandra/restore 0.27.1 Creates a CassandraRestore custom resource inst...
We can just install k8ssandra/k8ssandra.
2.3 install K8ssandra with Helm
Helm is a way of managing Chart+Value. We prepare a yaml file (k8ssandra-values.yaml) to put some variables:
Cassandra: version: "4.0.0" cassandraLibDirVolume: storageClass: local-path size: true heap: size: 1G newGenSize: 1G resources: requests: cpu: 1000m memory: 2Gi limits: cpu: 1000m memory: 2Gi datacenters:-name: dc1 size: 1 racks:-name: default kube-prometheus-stack: grafana: adminUser: admin adminPassword: admin123 stargate: enabled: true replicas: 1 heapMB: 256 cpuReqMillicores: 200 cpuLimMillicores: 1000
Install K8ssandra:
$helm install-f k8ssandra-values.yaml k8ssandra k8ssandra/k8ssandraNAME: k8ssandraLAST DEPLOYED: Thu Sep 30 21:20:49 2021NAMESPACE: defaultSTATUS: deployedREVISION: 1
Do some necessary tests as follows:
$helm listNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSIONk8ssandra default 1 2021-09-30 21 21 kubectl describe CassandraDataCenter dc1 20 kubectl get cassandradatacentersNAME AGEdc1 49.409672869 + 0800 CST deployed k8ssandra-1.3.1$ kubectl get cassandradatacentersNAME AGEdc1 4m34s$ kubectl describe CassandraDataCenter dc1 | grep "Cassandra Operator Progress:" Cassandra Operator Progress: Ready
Check Pod and Service:
Get the username and password of the K8ssandra superuser
$kubectl get secret k8ssandra-superuser-o jsonpath= "{.data.username}" | base64-- decode; echok8ssandra-superuser$ kubectl get secret k8ssandra-superuser-o jsonpath= "{.data.password}" | base64-- decode; echoTNE5xOk45C1aQsj29qxw2.4 adds nodes
To create more Cassandra Node for high availability and capacity, we directly modify the k8ssandra-values.yaml as follows:
Cassandra: version: "4.0.0" cassandraLibDirVolume: storageClass: local-path size: true heap: size: 1G newGenSize: 1G resources: requests: cpu: 1000m memory: 2Gi limits: cpu: 1000m memory: 2Gi datacenters:-name: dc1 size: 3 racks:-name: racks1-name: racks2-name: racks3kube-prometheus-stack: grafana: adminUser: admin adminPassword: Admin123 stargate: enabled: true replicas: 1 heapMB: 256 cpuReqMillicores: 200 cpuLimMillicores: 1000
After the modification, upgrade the configuration:
$helm upgrade-f k8ssandra-values.yaml k8ssandra k8ssandra/k8ssandraRelease "k8ssandra" has been upgraded. Happy Helming!NAME: k8ssandraLAST DEPLOYED: Fri Oct 1 00:40:08 2021NAMESPACE: defaultSTATUS: deployedREVISION: 2
View resources related to Kubernetes:
3 View Monitoring
Let's expose the Grafana service to take a look:
Kubectl expose deployment k8ssandra-grafana-type=NodePort-name=grafana-out
Find port 30348 of the corresponding NodePort and visit: http:// public network IP:30348
Account number: admin/admin123
The interface is as follows to provide a good monitoring interface:
4 Summary
K8ssandra is really a good open source project. I'll show you how to use Cassandra through K8ssandra in development later.
For the code, please see: https://github.com/LarryDpk/pkslow-samples
Reference:
Apache Cassandra Operations in Kubernetes
K8ssandra Get Started
Install K8ssandra on GKE
K8ssandra Helm Chart
Deploy Kubernetes applications with Helm to support multi-environment deployment and version rollback
Attached:
The image used:
Root@k8ssandra:~# docker images | sort | grep-v REPOSITORY | grep-v k8s.gcr.ioalpine 3.12.2 b14afc6dfb98 9 months ago 5.57MBbusybox 1.33.1 16ea53ea7c65 2 weeks ago 1.24MBbusybox Latest 16ea53ea7c65 2 weeks ago 1.24MBdatastax/cass-config-builder 1.0.4 907e52ff2f78 4 months ago 354MBgcr.io/k8s-minikube/storage-provisioner v5 6e38f40d628d 6 months ago 31.5MBgrafana/grafana 7.3.5 71716d95fc52 9 months ago 187MBjettech/kube-webhook-certgen v1.5.0 344297e197b6 11 months ago 44.7MBk8ssandra/cass-management-api 3.11.10-v0.1.27 e88cc3a8ce75 2 months ago 877MBk8ssandra/cass-management-api 4.0.0-v0.1.28 59b9869dd160 7 weeks ago 726MBk8ssandra/cass-operator v1.7.1 dd57363b0794 4 months ago 49.4MBk8ssandra/k8ssandra-tools latest 43e4bd91cf9b 42 hours ago 49MBk8ssandra/reaper-operator v0.3.3 B4cb9084a5e5 2 months ago 45.9MBk8ssandra/system-logger 9c4c3692 4dda0db106cb 4 months ago 5.66MBkiwigrid/k8s-sidecar 1.1.0 f4bb3bf1ddc7 11 months ago 82MBquay.io/prometheus-operator/prometheus-config-reloader v0.44.0 73bc771f8028 10 months ago 13.4MBquay.io/ Prometheus-operator/prometheus-operator v0.44.0 f5ab8d7a1a64 10 months ago 42.6MBquay.io/prometheus/prometheus v2.22.1 7cc97b58fb0e 10 months ago 168MBrancher/local-path-provisioner v0.0.20 933989e1174c 2 months ago 35MBstargateio/stargate-3_11 V1.0.29 c276fffd9964 3 months ago 537MBstargateio/stargate-4_0 v1.0.29 be4bae3748e1 3 months ago 546MBthelastpickle/cassandra-reaper 2.3.1 8ad2c2784ead 2 months ago 418MB to this The study on "how to deploy K8ssandra to Kubernetes on Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.