In this session we will be taking a look at running a distributed system on top of another distributed system while using persistant storage to make sure our data stays in tact.
Workshop attendees will receave an email with the instance info prior to the workshop.
Notice that training cloud instances will be available only during the workshop and will be terminated 24 hours later. If you are in our workshop we recommend using the provided cloud instance, you can relax as we have you covered: prerequisites are installed already.
⚡ IMPORTANT NOTE:
Everywhere in this repo you see <YOURADDRESS>
replace with the URL for the instance you were given.
Title | Description |
---|---|
1 - Getting Connected | Instructions |
2 - Setting Up Storage | Instructions |
3 - Setting Up Cassandra | Instructions |
4 - Connecting To Cassandra | Instructions |
5 - Resources | Instructions |
✅ Step 1a: The first step in the section.
In your browser window, navigate to the url :3000 where your address is the one emailed to you before the session.
When you arrive at the webpage you should be greeted by something similar to this.
Click in the Terminal
menu from the top of the page and select new terminal as shown below
Once you have opened the terminal run
kubectl get nodes
📃output
NAME STATUS ROLES AGE VERSION
learning-cluster-master Ready master 49m v1.19.4
learning-cluster-worker-0 Ready <none> 49m v1.19.4
learning-cluster-worker-1 Ready <none> 49m v1.19.4
ubuntu@learning-cluster-master:~/workshop$
If you see the above output you are ready for the lab.
✅ Step 2a: Setting Up Block Devices.
kubectl get pods --all-namespaces
wget https://openebs.github.io/charts/openebs-operator.yaml
kubectl apply -f openebs-operator.yaml
kubectl get pods --all-namespaces
kubectl get blockdevice -n openebs
kubectl label bd -n openebs BLOCKDEVICENAMEHERE openebs.io/block-device-tag=learning
kubectl label bd -n openebs BLOCKDEVICENAMEHERE openebs.io/block-device-tag=learning
kubectl apply -f local-device-sc.yaml
kubectl get sc local-device
✅ Step 2b: Verify Config
kubectl get sc local-device
✅ Step 3a: Install Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
✅ Step 3b: Add the K8ssandra repo
helm repo add k8ssandra https://helm.k8ssandra.io/stable
helm repo update
✅ Step 3c: Setup the Ingress
helm repo add traefik https://helm.traefik.io/traefik
helm repo update
helm install traefik traefik/traefik -f traefik.yaml
✅ Step 3d: configure the k8ssandra.yaml Open the file in the browser and add in your IP address where it says
✅ Step 3e: Install the Cassandra Cluster
helm install -f k8ssandra.yaml k8ssandra k8ssandra/k8ssandra
kubectl get cassandradatacenters
kubectl describe CassandraDataCenter dc1
✅ Step 4a: Retreave the Cluster username
kubectl get secret k8ssandra-superuser -o jsonpath="{.data.username}" | base64 --decode
✅ Step 4b: Retreave the Cluster password
kubectl get secret k8ssandra-superuser -o jsonpath="{.data.password}" | base64 --decode
✅ Step 4c: Install the Cassandra driver
sudo pip3 install cassandra-driver
✅ Step 4d: Testing our database
kubectl exec --stdin --tty k8ssandra-dc1-default-sts-0 -- /bin/bash
cqlsh -u YOURUSERNAME -p YOURPASSWORD
✅ Step 4e: Insert Data
CREATE KEYSPACE test WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'dc1' : 3 };
CREATE TABLE test.users (username text, name text, age int, PRIMARY KEY(username));
INSERT INTO test.users(username,name,age) VALUES ('EricZ','Eric Zietlow',67);
For further reading go to the OpenEBS Docs Check out our new Discord server Invite Get into more with the Data On Kubernetes Community DOKc For the K8ssandra Project k8ssandra.io Many more workshops to come so Please subscribe to the YouTube Channel to be notified.