This demo sheet was originally cloned from Nick Jones’ demo.org gist
(shell "konvoy-sh")
(switch-to-buffer "kudo-demo-sheet.org")
(delete-other-windows )
(switch-to-buffer-other-window "konvoy-sh")
;;(switch-to-buffer "kudo-cheatsheet.org")
Note there is no operators
or api-resources
resource type
kubectl get crds
kubectl get pods
kubectl get operators
kubectl api-resources
Look at https://github.com/kudobuilder/kudo/releases
TODO: get latest release, install
This is pure kubernetes - installs prerequisites with custom resource definitions (CRD)
If you’re using the new KUDO CLI which has this commit (v0.6.0 or later) then you can do:
kubectl kudo init
Otherwise:
kubectl create -f https://raw.githubusercontent.com/kudobuilder/kudo/v0.5.0/docs/deployment/00-prereqs.yaml
kubectl create -f https://raw.githubusercontent.com/kudobuilder/kudo/v0.5.0/docs/deployment/10-crds.yaml
kubectl create -f https://raw.githubusercontent.com/kudobuilder/kudo/v0.5.0/docs/deployment/20-deployment.yaml
kubectl get crds | grep kudo
kubectl api-resources --api-group kudo.dev
kubectl kudo install zookeeper --instance zk
kubectl kudo plan status --instance zk
kubectl get pods -w
# mype=$(kubectl get planexecutions | grep 'zk-deploy-' | cut -d' ' -f1)
# kubectl get planexecutions
# kubectl describe planexecution ${mype}
# EDITOR=emacsclient kubectl edit planexecution ${mype}
kubectl kudo get instances
kubectl kudo plan status --instance zk
kubectl get statefulset zk-zookeeper
EDITOR=emacsclient kubectl edit statefulset zk-zookeeper
kubectl get operators
kubectl get operatorversions
kubectl describe operatorversion zookeeper-0.2.0
EDITOR=emacsclient kubectl edit operatorversion zookeeper-0.2.0
# cd ~/projects/mesosphere/kudo/operators/repository/kafka/operator/
# kubectl kudo install . --instance kafka
kubectl kudo install kafka --instance=kafka \
-p ZOOKEEPER_URI=zk-zookeeper-0.zk-hs:2181,zk-zookeeper-1.zk-hs:2181,zk-zookeeper-2.zk-hs:2181 \
-p BROKER_MEM=1024m \
--version=0.1.3
# kubectl kudo install kafka --instance=kafka -p BROKER_MEM=1024m
kubectl kudo plan status --instance=kafka
kubectl get instances
kubectl get operators
kubectl get operatorversions
kubectl describe operatorversions kafka-1.0.1 | tee /tmp/kafka-1.0.1.yaml
EDITOR=emacsclient kubectl edit operatorversions kafka-0.2.0
kubectl get configmaps
EDITOR=emacsclient kubectl edit configmaps
kubectl kudo plan status --instance=kafka
kubectl describe instance kafka
kubectl kudo plan status --instance kafka
kubectl get pods -w
kubectl logs kafka-kafka-0 | grep 'Kafka version'
kubectl get svc
kubectl run -it --image=busybox --restart=Never sh
wget -O - kafka-svc:9094
kubectl delete pod sh
Konvoy will already have this set up
# From a clone of the Prometheus Operator: https://github.com/coreos/kube-prometheus
kubectl apply -f manifests/
# Once everything is running
kubectl --namespace monitoring port-forward svc/grafana 3000
# Add the Kafka service monitor definition from the kudo-kafka-demo repo
kubectl apply -f service-monitor.yml
# Browse to localhost:3000 and load the dashboard from https://raw.githubusercontent.com/kudobuilder/operators/master/repository/kafka/docs/v0.1/resources/grafana-dashboard.json
Run the following command to enable Kafka metrics export:
kubectl create -f https://raw.githubusercontent.com/kudobuilder/operators/master/repository/kafka/docs/v0.2/resources/service-monitor.yaml
From a checkout of the KUDO Kafka demo: https://github.com/zmalik/kudo-kafka-demo
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: kudo-kafka-generator
spec:
replicas: 1
template:
metadata:
name: kudo-kafka-generator
labels:
app: kudo-kafka-generator
spec:
containers:
- name: kudo-kafka-generator
image: mesosphere/flink-generator:0.1
command: ["/generator-linux"]
imagePullPolicy: Always
args: ["--broker", "kafka-kafka-0.kafka-svc:9092"]
kubectl apply -f /tmp/kafka-producer-generator.yaml
kubectl get pods
mypod=$(kubectl get pods | grep 'kudo-kafka-generator' | cut -d' ' -f1)
kubectl logs -f ${mypod}
kubectl get deployments
Consume the messages being generated on the Kafka topic
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: kudo-kafka-consumer
spec:
replicas: 1
template:
metadata:
name: kudo-kafka-consumer
labels:
app: kudo-kafka-consumer
spec:
containers:
- name: kudo-kafka-consumer
image: tbaums/kudo-kafka-demo
imagePullPolicy: Always
env:
- name: BROKER_SERVICE
value: kafka-kafka-0.kafka-svc:9092
kubectl apply -f /tmp/kafka-consumer.yaml
kubectl get pods
mypod=$(kubectl get pods | grep 'kudo-kafka-consumer' | cut -d' ' -f1)
kubectl logs -f ${mypod}
kubectl get deployments
Upgrade your Kafka cluster to 2.3.0 (the version of the KUDO Kafka operator is 1.0.0) using the following command:
kubectl kudo upgrade kafka --version=1.0.0 --instance kafka
kubectl kudo update --instance kafka -p BROKER_MEM=2048Mi -p BROKER_COUNT=5
kubectl describe svc kafka-svc
kubectl get svc
kubectl describe svc kafka-svc
kubectl run -it --image=busybox --restart=Never sh
wget -O - kafka-svc:9094/metrics
# cd ~/projects/mesosphere/kudo/operators/repository/mysql/operator/
# kubectl kudo install . --instance mysql
kubectl kudo install mysql --instance mysql
kubectl get pods -l app=mysql -o jsonpath="{.items[*].metadata.name}" ; echo
export MYSQL_POD=$(kubectl get pods -l app=mysql -o jsonpath="{.items[*].metadata.name}")
echo $MYSQL_POD
MYSQL_POD=`kubectl get pods -l app=mysql -o jsonpath="{.items[*].metadata.name}"`
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "create database kudo;"
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "create table example (id INT, name varchar(25));" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "show tables;" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "INSERT INTO example ( id, name ) VALUES ( null, 'New Data' );" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "INSERT INTO example ( id, name ) VALUES ( null, 'New Data' );" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "INSERT INTO example ( id, name ) VALUES ( null, 'New Data' );" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "INSERT INTO example ( id, name ) VALUES ( null, 'New Data' );" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kudo
cat << EOF | kubectl apply -f -
apiVersion: kudo.dev/v1alpha1
kind: PlanExecution
metadata:
labels:
framework-version: mysql-57
instance: mysql
name: mysql-backup
namespace: default
spec:
instance:
kind: Instance
name: mysql
namespace: default
planName: backup
EOF
kubectl kudo plan status --instance mysql
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "delete from example;" kudo
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kudo
cat << EOF | kubectl apply -f -
apiVersion: kudo.dev/v1alpha1
kind: PlanExecution
metadata:
labels:
framework-version: mysql-57
instance: mysql
name: mysql-restore
namespace: default
spec:
instance:
kind: Instance
name: mysql
namespace: default
planName: restore
EOF
kubectl kudo plan status --instance mysql
kubectl exec -it $MYSQL_POD -- mysql -ppassword -e "select * from example;" kudo