-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathup.sh
executable file
·70 lines (55 loc) · 2.57 KB
/
up.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# build docker image with jmx exporter version 1.1.0
docker build . --no-cache --pull -t local/cp-server:7.8.1
docker save local/cp-server:7.8.1 -o cp-server.tar
# Start local k8s cluster with kind
echo "Starting local k8s cluster with kind"
kind create cluster --config ./demo/cluster.yaml
kind load image-archive cp-server.tar
# Helm repo add and update
echo "Adding and updating helm repos"
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add confluentinc https://packages.confluent.io/helm
helm repo update
# Install prometheus and grafana
echo "Installing prometheus and grafana"
helm install prom prometheus-community/kube-prometheus-stack -f demo/prom.values.yaml
# Install Confluent Operator
echo "Installing Confluent Operator"
kubectl create namespace confluent
kubectl label namespace confluent monitoring=confluent
kubectl config set-context --current --namespace confluent
helm upgrade --install confluent-operator confluentinc/confluent-for-kubernetes --namespace confluent
# Install podmonitor resource
kubectl apply -f pm-confluent.yaml -n confluent
# wait for the operator to be ready
echo "Waiting for the operator to be ready"
sleep 60
# Install Confluent Platform
echo "Installing Confluent Platform"
kubectl apply -f demo/confluent-platform-singlenode.yaml
# wait for the Confluent Platform to be ready
echo "Waiting for the Confluent Platform to be ready"
./update-dashboards.sh
# Create configmaps for grafana dashboards
echo "Creating configmaps for grafana dashboards"
kubectl create configmap grafana-zookeeper-cluster --from-file=dashboards/zookeeper-cluster.json
kubectl label configmap grafana-zookeeper-cluster grafana_dashboard=1
kubectl create configmap grafana-kafka-cluster --from-file=dashboards/kafka-cluster.json
kubectl label configmap grafana-kafka-cluster grafana_dashboard=1
kubectl create configmap grafana-cluster-linking --from-file=dashboards/cluster-linking.json
kubectl label configmap grafana-cluster-linking grafana_dashboard=1
# Wait resources to be ready
echo "Waiting resources to be ready"
# check if pod kafka-0 is running, otherwise sleep and retry
while [ "$(kubectl get pods -n confluent | grep kafka-0 | awk '{print $3}')" != "Running" ]
do
echo "Waiting for kafka-0 to be ready"
sleep 30
done
# Forward ports
echo "Forwarding ports"
kubectl port-forward svc/prometheus-operated 9090:9090 -n default > /dev/null 2>&1 &
kubectl port-forward svc/prom-grafana 3000:80 -n default > /dev/null 2>&1 &
echo "Login to grafana at http://localhost:3000 with admin/prom-operator"
echo "Done"