Skip to content

Commit d4c07b9

Browse files
committed
add zookeeper ops and monitoring docs
Signed-off-by: Rudro-25 <[email protected]>
1 parent 5025432 commit d4c07b9

57 files changed

Lines changed: 4554 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: kubedb.com/v1alpha2
2+
kind: ZooKeeper
3+
metadata:
4+
name: zookeeper-builtin-prom
5+
namespace: demo
6+
spec:
7+
version: 3.8.3
8+
replicas: 3
9+
storage:
10+
resources:
11+
requests:
12+
storage: "100Mi"
13+
storageClassName: standard
14+
accessModes:
15+
- ReadWriteOnce
16+
deletionPolicy: WipeOut
17+
monitor:
18+
agent: prometheus.io/builtin
19+
prometheus:
20+
serviceMonitor:
21+
labels:
22+
release: prometheus
23+
interval: 10s
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: prometheus-config
5+
labels:
6+
app: prometheus-demo
7+
namespace: monitoring
8+
data:
9+
prometheus.yml: |-
10+
global:
11+
scrape_interval: 5s
12+
evaluation_interval: 5s
13+
scrape_configs:
14+
- job_name: 'kubedb-databases'
15+
honor_labels: true
16+
scheme: http
17+
kubernetes_sd_configs:
18+
- role: endpoints
19+
# by default Prometheus server select all Kubernetes services as possible target.
20+
# relabel_config is used to filter only desired endpoints
21+
relabel_configs:
22+
# keep only those services that has "prometheus.io/scrape","prometheus.io/path" and "prometheus.io/port" anootations
23+
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape, __meta_kubernetes_service_annotation_prometheus_io_port]
24+
separator: ;
25+
regex: true;(.*)
26+
action: keep
27+
# currently KubeDB supported databases uses only "http" scheme to export metrics. so, drop any service that uses "https" scheme.
28+
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
29+
action: drop
30+
regex: https
31+
# only keep the stats services created by KubeDB for monitoring purpose which has "-stats" suffix
32+
- source_labels: [__meta_kubernetes_service_name]
33+
separator: ;
34+
regex: (.*-stats)
35+
action: keep
36+
# service created by KubeDB will have "app.kubernetes.io/name" and "app.kubernetes.io/instance" annotations. keep only those services that have these annotations.
37+
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_name]
38+
separator: ;
39+
regex: (.*)
40+
action: keep
41+
# read the metric path from "prometheus.io/path: <path>" annotation
42+
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
43+
action: replace
44+
target_label: __metrics_path__
45+
regex: (.+)
46+
# read the port from "prometheus.io/port: <port>" annotation and update scraping address accordingly
47+
- source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
48+
action: replace
49+
target_label: __address__
50+
regex: ([^:]+)(?::\d+)?;(\d+)
51+
replacement: $1:$2
52+
# add service namespace as label to the scraped metrics
53+
- source_labels: [__meta_kubernetes_namespace]
54+
separator: ;
55+
regex: (.*)
56+
target_label: namespace
57+
replacement: $1
58+
action: replace
59+
# add service name as a label to the scraped metrics
60+
- source_labels: [__meta_kubernetes_service_name]
61+
separator: ;
62+
regex: (.*)
63+
target_label: service
64+
replacement: $1
65+
action: replace
66+
# add stats service's labels to the scraped metrics
67+
- action: labelmap
68+
regex: __meta_kubernetes_service_label_(.+)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: kubedb.com/v1alpha2
2+
kind: ZooKeeper
3+
metadata:
4+
name: zookeeper
5+
namespace: demo
6+
spec:
7+
version: 3.8.3
8+
replicas: 3
9+
storage:
10+
resources:
11+
requests:
12+
storage: "100Mi"
13+
storageClassName: longhorn
14+
accessModes:
15+
- ReadWriteOnce
16+
deletionPolicy: WipeOut
17+
monitor:
18+
agent: prometheus.io/operator
19+
prometheus:
20+
serviceMonitor:
21+
labels:
22+
release: prometheus
23+
interval: 10s
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
stringData:
3+
zoo.cfg: |
4+
maxClientCnxns=100
5+
kind: Secret
6+
metadata:
7+
name: zk-new-configuration
8+
namespace: demo
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: kubedb.com/v1alpha2
2+
kind: ZooKeeper
3+
metadata:
4+
name: zk-quickstart
5+
namespace: demo
6+
spec:
7+
version: "3.8.3"
8+
adminServerPort: 8080
9+
replicas: 3
10+
configSecret:
11+
name: zk-configuration
12+
storage:
13+
resources:
14+
requests:
15+
storage: "1Gi"
16+
accessModes:
17+
- ReadWriteOnce
18+
deletionPolicy: "WipeOut"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
stringData:
3+
zoo.cfg: |
4+
maxClientCnxns=70
5+
kind: Secret
6+
metadata:
7+
name: zk-configuration
8+
namespace: demo
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: ops.kubedb.com/v1alpha1
2+
kind: ZooKeeperOpsRequest
3+
metadata:
4+
name: zk-reconfig-apply
5+
namespace: demo
6+
spec:
7+
type: Reconfigure
8+
databaseRef:
9+
name: zk-quickstart
10+
configuration:
11+
applyConfig:
12+
zoo.cfg: |
13+
maxClientCnxns=90
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: ops.kubedb.com/v1alpha1
2+
kind: ZooKeeperOpsRequest
3+
metadata:
4+
name: zk-reconfig
5+
namespace: demo
6+
spec:
7+
type: Reconfigure
8+
databaseRef:
9+
name: zk-quickstart
10+
configuration:
11+
configSecret:
12+
name: zk-new-configuration
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: ops.kubedb.com/v1alpha1
2+
kind: ZooKeeperOpsRequest
3+
metadata:
4+
name: zkops-remove
5+
namespace: demo
6+
spec:
7+
type: ReconfigureTLS
8+
databaseRef:
9+
name: zk-quickstart
10+
tls:
11+
remove: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: ops.kubedb.com/v1alpha1
2+
kind: ZooKeeperOpsRequest
3+
metadata:
4+
name: zkops-rotate
5+
namespace: demo
6+
spec:
7+
type: ReconfigureTLS
8+
databaseRef:
9+
name: zk-quickstart
10+
tls:
11+
rotateCertificates: true

0 commit comments

Comments
 (0)