- Kubernetes cluster (minikube should be okay)
- k9s
- kubectl
- docker cli
-
Create minikube cluster
minikube start --memory=8192 --cpus=2 --disk-size=40g --driver=docker -n=4
-n=3
- Runs 3 node cluster so that we can deploy multi node YugabyteDB cluster
-
Setup Helm
helm repo add yugabytedb https://charts.yugabyte.com helm repo update
-
Search for latest version
helm search repo yugabytedb/yugabyte -l
-
Create a namespace
kubectl create namespace yb-demo
-
Create 3 node cluster
helm install yb-demo yugabytedb/yugabyte \ --version 2.14.3 \ --set resource.master.requests.cpu=0.5 \ --set resource.master.requests.memory=0.5Gi \ --set resource.tserver.requests.cpu=0.5 \ --set resource.tserver.requests.memory=0.5Gi \ --set replicas.master=3 \ --set replicas.tserver=3 \ --namespace yb-demo
-
Get UI address
kubectl -n yb-demo get svc
-
Run SQL Shell
kubectl exec -it -n yb-demo yb-tserver-0 -c yb-tserver -- ysqlsh -h yb-tserver-0
-
Let's play SQL -- Choose Kubernetes
To exit type
exit
or\q
andenter/return
ORCtrl+D
-
Run Sample SQL
kubectl run yb-sample-apps \ -n yb-demo \ --rm \ -it \ --restart=Never \ --image=yogendra/yb-sample-apps \ -- \ --workload SqlInserts \ --nodes yb-tserver-0.yb-tservers:5433,yb-tserver-1.yb-tservers:5433,yb-tserver-0.yb-tservers:5433
-
Lets cause an node outage
kubectl scale statefulset -n yb-demo yb-tserver --replicas 2
(Observe app)
-
Lets restore the cluter
kubectl scale statefulset -n yb-demo yb-tserver --replicas 3
(Observe app)
-
Let upgrade our cluster