NOTES.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. CHART NAME: {{ .Chart.Name }}
  2. CHART VERSION: {{ .Chart.Version }}
  3. APP VERSION: {{ .Chart.AppVersion }}
  4. {{- if .Values.diagnosticMode.enabled }}
  5. The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
  6. command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
  7. args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
  8. Get the list of pods by executing:
  9. kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }}
  10. Access the pod you want to debug by executing
  11. kubectl exec --namespace {{ .Release.Namespace }} -ti <NAME OF THE POD> -- bash
  12. In order to replicate the container startup scripts execute this command:
  13. /opt/bitnami/scripts/kafka/entrypoint.sh /opt/bitnami/scripts/kafka/run.sh
  14. {{- else }}
  15. {{- $releaseNamespace := .Release.Namespace }}
  16. {{- $clusterDomain := .Values.clusterDomain }}
  17. {{- $fullname := include "common.names.fullname" . }}
  18. {{- $clientPort := int .Values.listeners.client.containerPort }}
  19. {{- if and (or (eq .Values.service.type "LoadBalancer") .Values.externalAccess.enabled) (eq (upper .Values.listeners.external.protocol) "PLAINTEXT") }}
  20. ---------------------------------------------------------------------------------------------
  21. WARNING
  22. By specifying "serviceType=LoadBalancer" and not configuring the authentication
  23. you have most likely exposed the Kafka service externally without any
  24. authentication mechanism.
  25. For security reasons, we strongly suggest that you switch to "ClusterIP" or
  26. "NodePort". As alternative, you can also configure the Kafka authentication.
  27. ---------------------------------------------------------------------------------------------
  28. {{- end }}
  29. ** Please be patient while the chart is being deployed **
  30. Kafka can be accessed by consumers via port {{ $clientPort }} on the following DNS name from within your cluster:
  31. {{ $fullname }}.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}
  32. Each Kafka broker can be accessed by producers via port {{ $clientPort }} on the following DNS name(s) from within your cluster:
  33. {{- $brokerList := list }}
  34. {{- range $i := until (int .Values.controller.replicaCount) }}
  35. {{- $brokerList = append $brokerList (printf "%s-controller-%d.%s-controller-headless.%s.svc.%s:%d" $fullname $i $fullname $releaseNamespace $clusterDomain $clientPort) }}
  36. {{- end }}
  37. {{- range $i := until (int .Values.broker.replicaCount) }}
  38. {{- $brokerList = append $brokerList (printf "%s-broker-%d.%s-broker-headless.%s.svc.%s:%d" $fullname $i $fullname $releaseNamespace $clusterDomain $clientPort) }}
  39. {{- end }}
  40. {{ join "\n" $brokerList | nindent 4 }}
  41. {{- $clientSaslEnabled := regexFind "SASL" (upper .Values.listeners.client.protocol) }}
  42. {{- $clientSslEnabled := regexFind "SSL" (upper .Values.listeners.client.protocol) }}
  43. {{- $clientMTlsEnabled := or (and .Values.listeners.client.sslClientAuth (not (eq .Values.listeners.client.sslClientAuth "none"))) (and (empty .Values.listeners.client.sslClientAuth) (not (eq .Values.tls.sslClientAuth "none"))) }}
  44. {{- if or $clientSaslEnabled $clientSslEnabled }}
  45. The {{ upper .Values.listeners.client.name }} listener for Kafka client connections from within your cluster have been configured with the following security settings:
  46. {{- if $clientSaslEnabled }}
  47. - SASL authentication
  48. {{- end }}
  49. {{- if $clientSslEnabled }}
  50. - TLS encryption
  51. {{- end }}
  52. {{- if and $clientSslEnabled $clientMTlsEnabled }}
  53. - mTLS authentication
  54. {{- end }}
  55. To connect a client to your Kafka, you need to create the 'client.properties' configuration files with the content below:
  56. security.protocol={{ .Values.listeners.client.protocol }}
  57. {{- if $clientSaslEnabled }}
  58. {{- if regexFind "OAUTHBEARER" (upper .Values.sasl.enabledMechanisms ) }}
  59. sasl.jaas.config="org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required"\
  60. clientId="<Valid id From OAUTH provider>" \
  61. password="<Valid password for id from OAUTH provider>";
  62. sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler
  63. sasl.oauthbearer.token.endpoint.url={{ .Values.sasl.oauthbearer.tokenEndpointUrl }}
  64. {{- else }}
  65. {{- if regexFind "SCRAM-SHA-256" (upper .Values.sasl.enabledMechanisms) }}
  66. sasl.mechanism=SCRAM-SHA-256
  67. {{- else if regexFind "SCRAM-SHA-512" (upper .Values.sasl.enabledMechanisms) }}
  68. sasl.mechanism=SCRAM-SHA-512
  69. {{- else if regexFind "PLAIN" (upper .Values.sasl.enabledMechanisms) }}
  70. sasl.mechanism=PLAIN
  71. {{- end }}
  72. {{- $securityModule := ternary "org.apache.kafka.common.security.scram.ScramLoginModule required" "org.apache.kafka.common.security.plain.PlainLoginModule required" (regexMatch "SCRAM" (upper .Values.sasl.enabledMechanisms)) }}
  73. sasl.jaas.config={{ $securityModule }} \
  74. username="{{ index .Values.sasl.client.users 0 }}" \
  75. password="$(kubectl get secret {{ $fullname }}-user-passwords --namespace {{ $releaseNamespace }} -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1)";
  76. {{- end }}
  77. {{- end }}
  78. {{- if $clientSslEnabled }}
  79. {{- $clientTlsType := upper .Values.tls.type }}
  80. ssl.truststore.type={{ $clientTlsType }}
  81. {{- if eq $clientTlsType "JKS" }}
  82. ssl.truststore.location=/tmp/kafka.truststore.jks
  83. # Uncomment this line if your client truststore is password protected
  84. #ssl.truststore.password=
  85. {{- else if eq $clientTlsType "PEM" }}
  86. ssl.truststore.certificates=-----BEGIN CERTIFICATE----- \
  87. ... \
  88. -----END CERTIFICATE-----
  89. {{- end }}
  90. {{- if and $clientMTlsEnabled }}
  91. ssl.keystore.type={{ $clientTlsType }}
  92. {{- if eq $clientTlsType "JKS" }}
  93. ssl.keystore.location=/tmp/client.keystore.jks
  94. # Uncomment this line if your client truststore is password protected
  95. #ssl.keystore.password=
  96. {{- else if eq $clientTlsType "PEM" }}
  97. ssl.keystore.certificate.chain=-----BEGIN CERTIFICATE----- \
  98. ... \
  99. -----END CERTIFICATE-----
  100. ssl.keystore.key=-----BEGIN ENCRYPTED PRIVATE KEY----- \
  101. ... \
  102. -----END ENCRYPTED PRIVATE KEY-----
  103. {{- end }}
  104. {{- end }}
  105. {{- if eq .Values.tls.endpointIdentificationAlgorithm "" }}
  106. ssl.endpoint.identification.algorithm=
  107. {{- end }}
  108. {{- end }}
  109. {{- end }}
  110. To create a pod that you can use as a Kafka client run the following commands:
  111. kubectl run {{ $fullname }}-client --restart='Never' --image {{ template "kafka.image" . }} --namespace {{ $releaseNamespace }} --command -- sleep infinity
  112. {{- if or $clientSaslEnabled $clientSslEnabled }}
  113. kubectl cp --namespace {{ $releaseNamespace }} /path/to/client.properties {{ $fullname }}-client:/tmp/client.properties
  114. {{- end }}
  115. {{- if and $clientSslEnabled (eq (upper .Values.tls.type) "JKS") }}
  116. kubectl cp --namespace {{ $releaseNamespace }} ./kafka.truststore.jks {{ $fullname }}-client:/tmp/kafka.truststore.jks
  117. {{- if $clientMTlsEnabled }}
  118. kubectl cp --namespace {{ $releaseNamespace }} ./client.keystore.jks {{ $fullname }}-client:/tmp/client.keystore.jks
  119. {{- end }}
  120. {{- end }}
  121. kubectl exec --tty -i {{ $fullname }}-client --namespace {{ $releaseNamespace }} -- bash
  122. PRODUCER:
  123. kafka-console-producer.sh \
  124. {{- if or $clientSaslEnabled $clientSslEnabled }}
  125. --producer.config /tmp/client.properties \
  126. {{- end }}
  127. --broker-list {{ join "," $brokerList }} \
  128. --topic test
  129. CONSUMER:
  130. kafka-console-consumer.sh \
  131. {{- if or $clientSaslEnabled $clientSslEnabled }}
  132. --consumer.config /tmp/client.properties \
  133. {{- end }}
  134. --bootstrap-server {{ $fullname }}.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ .Values.service.ports.client }} \
  135. --topic test \
  136. --from-beginning
  137. {{- if .Values.externalAccess.enabled }}
  138. {{- if or (not .Values.kraft.enabled) (not .Values.controller.controllerOnly) .Values.externalAccess.controller.forceExpose }}
  139. {{- if not .Values.kraft.enabled }}
  140. To connect to your Kafka nodes from outside the cluster, follow these instructions:
  141. {{- else if and .Values.controller.controllerOnly .Values.externalAccess.controller.forceExpose }}
  142. To connect to your Kafka controller-only nodes from outside the cluster, follow these instructions:
  143. {{- else }}
  144. To connect to your Kafka controller+broker nodes from outside the cluster, follow these instructions:
  145. {{- end }}
  146. {{- if eq "NodePort" .Values.externalAccess.controller.service.type }}
  147. {{- if .Values.externalAccess.controller.service.domain }}
  148. Kafka brokers domain: Use your provided hostname to reach Kafka brokers, {{ .Values.externalAccess.controller.service.domain }}
  149. {{- else }}
  150. Kafka brokers domain: You can get the external node IP from the Kafka configuration file with the following commands (Check the EXTERNAL listener)
  151. 1. Obtain the pod name:
  152. kubectl get pods --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka"
  153. 2. Obtain pod configuration:
  154. kubectl exec -it KAFKA_POD -- cat /opt/bitnami/kafka/config/server.properties | grep advertised.listeners
  155. {{- end }}
  156. Kafka brokers port: You will have a different node port for each Kafka broker. You can get the list of configured node ports using the command below:
  157. echo "$(kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -o jsonpath='{.items[*].spec.ports[0].nodePort}' | tr ' ' '\n')"
  158. {{- else if eq "LoadBalancer" .Values.externalAccess.controller.service.type }}
  159. NOTE: It may take a few minutes for the LoadBalancer IPs to be available.
  160. Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -w'
  161. Kafka Brokers domain: You will have a different external IP for each Kafka broker. You can get the list of external IPs using the command below:
  162. echo "$(kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -o jsonpath='{.items[*].status.loadBalancer.ingress[0].ip}' | tr ' ' '\n')"
  163. Kafka Brokers port: {{ .Values.externalAccess.controller.service.ports.external }}
  164. {{- else if eq "ClusterIP" .Values.externalAccess.controller.service.type }}
  165. Kafka brokers domain: Use your provided hostname to reach Kafka brokers, {{ .Values.externalAccess.controller.service.domain }}
  166. Kafka brokers port: You will have a different port for each Kafka broker starting at {{ .Values.externalAccess.controller.service.ports.external }}
  167. {{- end }}
  168. {{- end }}
  169. {{- $brokerReplicaCount := int .Values.broker.replicaCount -}}
  170. {{- if gt $brokerReplicaCount 0 }}
  171. To connect to your Kafka broker nodes from outside the cluster, follow these instructions:
  172. {{- if eq "NodePort" .Values.externalAccess.broker.service.type }}
  173. {{- if .Values.externalAccess.broker.service.domain }}
  174. Kafka brokers domain: Use your provided hostname to reach Kafka brokers, {{ .Values.externalAccess.broker.service.domain }}
  175. {{- else }}
  176. Kafka brokers domain: You can get the external node IP from the Kafka configuration file with the following commands (Check the EXTERNAL listener)
  177. 1. Obtain the pod name:
  178. kubectl get pods --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka"
  179. 2. Obtain pod configuration:
  180. kubectl exec -it KAFKA_POD -- cat /opt/bitnami/kafka/config/server.properties | grep advertised.listeners
  181. {{- end }}
  182. Kafka brokers port: You will have a different node port for each Kafka broker. You can get the list of configured node ports using the command below:
  183. echo "$(kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -o jsonpath='{.items[*].spec.ports[0].nodePort}' | tr ' ' '\n')"
  184. {{- else if eq "LoadBalancer" .Values.externalAccess.broker.service.type }}
  185. NOTE: It may take a few minutes for the LoadBalancer IPs to be available.
  186. Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -w'
  187. Kafka Brokers domain: You will have a different external IP for each Kafka broker. You can get the list of external IPs using the command below:
  188. echo "$(kubectl get svc --namespace {{ include "common.names.namespace" . }} -l "app.kubernetes.io/name={{ template "kafka.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=kafka,pod" -o jsonpath='{.items[*].status.loadBalancer.ingress[0].ip}' | tr ' ' '\n')"
  189. Kafka Brokers port: {{ .Values.externalAccess.broker.service.ports.external }}
  190. {{- else if eq "ClusterIP" .Values.externalAccess.broker.service.type }}
  191. Kafka brokers domain: Use your provided hostname to reach Kafka brokers, {{ .Values.externalAccess.broker.service.domain }}
  192. Kafka brokers port: You will have a different port for each Kafka broker starting at {{ .Values.externalAccess.broker.service.ports.external }}
  193. {{- end }}
  194. {{- end }}
  195. {{- if or $clientSaslEnabled $clientSslEnabled }}
  196. {{- $externalSaslEnabled := regexFind "SASL" (upper .Values.listeners.external.protocol) }}
  197. {{- $externalSslEnabled := regexFind "SSL" (upper .Values.listeners.external.protocol) }}
  198. {{- $externalMTlsEnabled := or (and .Values.listeners.external.sslClientAuth (not (eq .Values.listeners.external.sslClientAuth "none"))) (and (empty .Values.listeners.external.sslClientAuth) (not (eq .Values.tls.sslClientAuth "none"))) }}
  199. The {{ upper .Values.listeners.external.name }} listener for Kafka client connections from within your cluster have been configured with the following settings:
  200. {{- if $externalSaslEnabled }}
  201. - SASL authentication
  202. {{- end }}
  203. {{- if $externalSslEnabled }}
  204. - TLS encryption
  205. {{- end }}
  206. {{- if and $externalSslEnabled $externalMTlsEnabled }}
  207. - mTLS authentication
  208. {{- end }}
  209. To connect a client to your Kafka, you need to create the 'client.properties' configuration files with the content below:
  210. security.protocol={{ .Values.listeners.external.protocol }}
  211. {{- if $externalSaslEnabled }}
  212. {{- if regexFind "OAUTHBEARER" (upper .Values.sasl.enabledMechanisms ) }}
  213. sasl.jaas.config="org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required"\
  214. clientId="<Valid id From OAUTH provider>" \
  215. password="<Valid password for id from OAUTH provider>";
  216. sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler
  217. sasl.oauthbearer.token.endpoint.url={{ .Values.sasl.oauthbearer.tokenEndpointUrl }}
  218. {{- else }}
  219. {{- if regexFind "SCRAM-SHA-256" (upper .Values.sasl.enabledMechanisms) }}
  220. sasl.mechanism=SCRAM-SHA-256
  221. {{- else if regexFind "SCRAM-SHA-512" (upper .Values.sasl.enabledMechanisms) }}
  222. sasl.mechanism=SCRAM-SHA-512
  223. {{- else }}
  224. sasl.mechanism=PLAIN
  225. {{- end }}
  226. {{- $securityModule := ternary "org.apache.kafka.common.security.scram.ScramLoginModule required" "org.apache.kafka.common.security.plain.PlainLoginModule required" (regexMatch "SCRAM" (upper .Values.sasl.enabledMechanisms)) }}
  227. sasl.jaas.config={{ $securityModule }} \
  228. username="{{ index .Values.sasl.client.users 0 }}" \
  229. password="$(kubectl get secret {{ $fullname }}-user-passwords --namespace {{ $releaseNamespace }} -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1)";
  230. {{- end }}
  231. {{- end }}
  232. {{- if $externalSslEnabled }}
  233. {{- $clientTlsType := upper .Values.tls.type }}
  234. ssl.truststore.type={{ $clientTlsType }}
  235. {{- if eq $clientTlsType "JKS" }}
  236. ssl.truststore.location=/tmp/kafka.truststore.jks
  237. # Uncomment this line if your client truststore is password protected
  238. #ssl.truststore.password=
  239. {{- else if eq $clientTlsType "PEM" }}
  240. ssl.truststore.certificates=-----BEGIN CERTIFICATE----- \
  241. ... \
  242. -----END CERTIFICATE-----
  243. {{- end }}
  244. {{- if and $externalMTlsEnabled }}
  245. ssl.keystore.type={{ $clientTlsType }}
  246. {{- if eq $clientTlsType "JKS" }}
  247. ssl.keystore.location=/tmp/client.keystore.jks
  248. # Uncomment this line if your client truststore is password protected
  249. #ssl.keystore.password=
  250. {{- else if eq $clientTlsType "PEM" }}
  251. ssl.keystore.certificate.chain=-----BEGIN CERTIFICATE----- \
  252. ... \
  253. -----END CERTIFICATE-----
  254. ssl.keystore.key=-----BEGIN ENCRYPTED PRIVATE KEY----- \
  255. ... \
  256. -----END ENCRYPTED PRIVATE KEY-----
  257. {{- end }}
  258. {{- end }}
  259. {{- if eq .Values.tls.endpointIdentificationAlgorithm "" }}
  260. ssl.endpoint.identification.algorithm=
  261. {{- end }}
  262. {{- end }}
  263. {{- end }}
  264. {{- end }}
  265. {{- end }}
  266. {{- include "kafka.checkRollingTags" . }}
  267. {{- include "kafka.validateValues" . }}
  268. {{- include "common.warnings.resources" (dict "sections" (list "broker" "controller" "externalAccess.autoDiscovery" "metrics.jmx" "metrics.kafka" "provisioning" "volumePermissions") "context" $) }}