-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema-registry.yml
265 lines (262 loc) · 7.6 KB
/
schema-registry.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: schema-registry
meta.helm.sh/release-namespace: kafka
labels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
name: schema-registry-headless
namespace: kafka
spec:
clusterIP: None
ports:
- name: http
port: 8081
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: schema-reg-cp-schema-registry
labels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
namespace: kafka
spec:
ports:
- name: schema-registry
port: 8081
- name: metrics
port: 5556
selector:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: kafka-schema-reg
namespace: kafka
spec:
endpoints:
- interval: 5s
path: /metrics
port: metrics
jobLabel: kafka-schema-reg
namespaceSelector:
matchNames:
- kafka
selector:
matchLabels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sch-registry
namespace: kafka
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
serviceName: schema-registry
template:
metadata:
labels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- name: prometheus-jmx-exporter
image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
imagePullPolicy: "IfNotPresent"
command:
- java
- -XX:+UnlockExperimentalVMOptions
- -XX:+UseCGroupMemoryLimitForHeap
- -XX:MaxRAMFraction=1
- -XshowSettings:vm
- -jar
- jmx_prometheus_httpserver.jar
- "5556"
- /etc/jmx-schema-registry/jmx-schema-registry-prometheus.yml
ports:
- containerPort: 5556
resources:
limits:
memory: 768Mi
requests:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: jmx-config
mountPath: /etc/jmx-schema-registry
- image: confluentinc/cp-schema-registry
name: sch-registry
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: SCHEMA_REGISTRY_LISTENERS
value: http://0.0.0.0:8081
- name: SCHEMA_REGISTRY_AVRO_COMPATIBILY_LEVEL
value: backward
- name: SCHEMA_REGISTRY_HOST_NAME
value: $(MY_POD_NAME).schema-registry-headless.kafka.svc.cluster.local
- name: SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS
value: SASL_PLAINTEXT://kafka-kafka-0.kafka-kafka-brokers.kafka.svc:9092
- name: SCHEMA_REGISTRY_AUTHENTICATION_METHOD
value: BASIC
- name: SCHEMA_REGISTRY_AUTHENTICATION_REALM
value: "SchemaRegistry-Props"
- name: SCHEMA_REGISTRY_AUTHENTICATION_ROLES
value: "admin,readwrite,readonly"
- name: SCHEMA_REGISTRY_KAFKASTORE_SECURITY_PROTOCOL
value: SASL_PLAINTEXT
- name: SCHEMA_REGISTRY_KAFKASTORE_SASL_MECHANISM
value: SCRAM-SHA-512
- name: SCHEMA_REGISTRY_KAFKASTORE_SASL_JAAS_CONFIG
valueFrom:
secretKeyRef:
name: schema-reg-sasl-config
key: config
- name: SCHEMA_REGISTRY_OPTS
value: "-Djava.security.auth.login.config=/etc/schema-registry/jaas-config.config"
- name: SCHEMA_REGISTRY_HEAP_OPTS
value: "-Xms512M -Xmx512M"
- name: JMX_PORT
value: "5555"
# - name: SCHEMA_REGISTRY_LOG4J_LOGGERS
# value: "org.apache.kafka=ERROR,io.confluent.rest.exceptions=ERROR"
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 10
periodSeconds: 20
successThreshold: 1
tcpSocket:
port: http
timeoutSeconds: 1
ports:
- containerPort: 8081
name: http
protocol: TCP
readinessProbe:
failureThreshold: 6
initialDelaySeconds: 10
periodSeconds: 20
successThreshold: 1
tcpSocket:
port: http
timeoutSeconds: 1
resources:
limits:
ephemeral-storage: 1Gi
memory: 768Mi
requests:
cpu: 500m
ephemeral-storage: 50Mi
memory: 512Mi
volumeMounts:
- mountPath: /etc/schema-registry/credentials.txt
name: credentials
subPath: credentials
- mountPath: /etc/schema-registry/jaas-config.config
name: jaas-config
subPath: jaas-config
volumes:
- secret:
defaultMode: 420
secretName: schema-reg-credentials
name: credentials
- configMap:
defaultMode: 420
name: schema-reg-jaas-config
name: jaas-config
- name: jmx-config
configMap:
name: schema-reg-cp-schema-registry-jmx-configmap
---
apiVersion: v1
kind: ConfigMap
metadata:
name: schema-reg-jaas-config
namespace: kafka
data:
jaas-config: |
SchemaRegistry-Props {
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
file="/etc/schema-registry/credentials.txt"
debug="true";
};
---
apiVersion: v1
kind: ConfigMap
metadata:
name: schema-reg-cp-schema-registry-jmx-configmap
namespace: kafka
labels:
app.kubernetes.io/instance: schema-registry
app.kubernetes.io/name: schema-registry
data:
jmx-schema-registry-prometheus.yml: |+
jmxUrl: service:jmx:rmi:///jndi/rmi://localhost:5555/jmxrmi
lowercaseOutputName: true
lowercaseOutputLabelNames: true
ssl: false
whitelistObjectNames:
- kafka.schema.registry:type=jetty-metrics
- kafka.schema.registry:type=master-slave-role
- kafka.schema.registry:type=jersey-metrics
rules:
- pattern : 'kafka.schema.registry<type=jetty-metrics>([^:]+):'
name: "cp_kafka_schema_registry_jetty_metrics_$1"
- pattern : 'kafka.schema.registry<type=master-slave-role>([^:]+):'
name: "cp_kafka_schema_registry_master_slave_role"
- pattern : 'kafka.schema.registry<type=jersey-metrics>([^:]+):'
name: "cp_kafka_schema_registry_jersey_metrics_$1"
---
apiVersion: v1
data:
credentials: yourhash
#decrypted value: org.apache.kafka.common.security.scram.ScramLoginModule required username=yourusername password=yourpass;
kind: Secret
metadata:
name: schema-reg-credentials
namespace: kafka
type: Opaque
---
apiVersion: v1
data:
config: yourhash
##decrypted value: |
### admin: 4egJb0DCao5S2w,admin
### test: gx1jl82RMGGjU,readwrite
### test-dev: 4t4LNh7SRx3qh9J,readonly
kind: Secret
metadata:
name: schema-reg-sasl-config
namespace: kafka
type: Opaque