Commit e65b8e99be0e666c66bc9a8a93ddad7f102ff1f7

Authored by Volodymyr Babak
1 parent c38b61bb

Fixed kafka stateful service

Showing 1 changed file with 29 additions and 10 deletions
@@ -117,12 +117,10 @@ kind: StatefulSet @@ -117,12 +117,10 @@ kind: StatefulSet
117 metadata: 117 metadata:
118 name: tb-kafka 118 name: tb-kafka
119 namespace: thingsboard 119 namespace: thingsboard
120 - labels:  
121 - app: tb-kafka  
122 spec: 120 spec:
  121 + serviceName: "tb-kafka"
123 replicas: 3 122 replicas: 3
124 podManagementPolicy: OrderedReady 123 podManagementPolicy: OrderedReady
125 - serviceName: server  
126 selector: 124 selector:
127 matchLabels: 125 matchLabels:
128 app: tb-kafka 126 app: tb-kafka
@@ -137,23 +135,40 @@ spec: @@ -137,23 +135,40 @@ spec:
137 image: wurstmeister/kafka:2.12-2.2.1 135 image: wurstmeister/kafka:2.12-2.2.1
138 ports: 136 ports:
139 - containerPort: 9092 137 - containerPort: 9092
  138 + name: kafka-int
  139 + - containerPort: 9093
  140 + name: kafka-ext
140 readinessProbe: 141 readinessProbe:
141 - periodSeconds: 20 142 + periodSeconds: 5
  143 + timeoutSeconds: 5
142 tcpSocket: 144 tcpSocket:
143 port: 9092 145 port: 9092
  146 + initialDelaySeconds: 60
144 livenessProbe: 147 livenessProbe:
  148 + timeoutSeconds: 5
145 periodSeconds: 5 149 periodSeconds: 5
146 tcpSocket: 150 tcpSocket:
147 port: 9092 151 port: 9092
  152 + initialDelaySeconds: 80
148 env: 153 env:
149 - name: BROKER_ID_COMMAND 154 - name: BROKER_ID_COMMAND
150 value: "hostname | cut -d'-' -f3" 155 value: "hostname | cut -d'-' -f3"
151 - name: KAFKA_ZOOKEEPER_CONNECT 156 - name: KAFKA_ZOOKEEPER_CONNECT
152 value: "zookeeper:2181" 157 value: "zookeeper:2181"
153 - - name: KAFKA_ADVERTISED_PORT  
154 - value: "9092" 158 + - name: KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS
  159 + value: "60000"
  160 + - name: KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE
  161 + value: "true"
155 - name: KAFKA_LISTENERS 162 - name: KAFKA_LISTENERS
156 - value: "PLAINTEXT://:9092" 163 + value: "INSIDE://:9092,OUTSIDE://:9093"
  164 + - name: KAFKA_ADVERTISED_LISTENERS
  165 + value: "INSIDE://:9092,OUTSIDE://:9093"
  166 + - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
  167 + value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
  168 + - name: KAFKA_INTER_BROKER_LISTENER_NAME
  169 + value: "INSIDE"
  170 + - name: KAFKA_CONTROLLER_SHUTDOWN_ENABLE
  171 + value: "true"
157 - name: KAFKA_CREATE_TOPICS 172 - name: KAFKA_CREATE_TOPICS
158 value: "js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600" 173 value: "js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600"
159 - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE 174 - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
@@ -191,11 +206,15 @@ metadata: @@ -191,11 +206,15 @@ metadata:
191 namespace: thingsboard 206 namespace: thingsboard
192 spec: 207 spec:
193 type: ClusterIP 208 type: ClusterIP
  209 + ports:
  210 + - port: 9092
  211 + targetPort: 9092
  212 + name: kafka-int
  213 + - port: 9093
  214 + targetPort: 9093
  215 + name: kafka-ext
194 selector: 216 selector:
195 app: tb-kafka 217 app: tb-kafka
196 - ports:  
197 - - name: tb-kafka-port  
198 - port: 9092  
199 --- 218 ---
200 apiVersion: v1 219 apiVersion: v1
201 kind: ConfigMap 220 kind: ConfigMap