Skip to content

[bitnami/kafka] Support external access to every broker auto-discovering external ips/ports#2098

Merged
juan131 merged 6 commits intobitnami:masterfrom
juan131:kafka-external-access
Mar 23, 2020
Merged

[bitnami/kafka] Support external access to every broker auto-discovering external ips/ports#2098
juan131 merged 6 commits intobitnami:masterfrom
juan131:kafka-external-access

Conversation

@juan131
Copy link
Copy Markdown
Contributor

@juan131 juan131 commented Mar 20, 2020

Description of the change

This PR adds support to configure external access to every broker auto-discovering external ips/ports.

There are other features added:

  • Add sidecar containers
  • Fix issue with SASL/SSL configuration
  • Fix issue with Kafka Broker ID

Benefits

  • Easier way to configure external access to every Kafka broker
  • Flexibility (sidecars)

Possible drawbacks

None

Checklist

  • Chart version bumped in Chart.yaml according to semver.
  • Variables are documented in the README.md
  • Title of the PR starts with chart name (e.g. [bitnami/chart])
  • If the chart contains a values-production.yaml apart from values.yaml, ensure that you implement the changes in both files

@carrodher
Copy link
Copy Markdown
Member

I just resolved some conflicts

Copy link
Copy Markdown
Contributor

@rafariossaa rafariossaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found several port values not being able to be set in the values.yml, I think it is a good idea to let the user set them.
I added some comments on that on the code, but not all, please check all the statefulset.yaml file because I omitted several occurrences.

@juan131
Copy link
Copy Markdown
Contributor Author

juan131 commented Mar 21, 2020

@rafariossaa the ports that are 'hardcoded' are the ones used on the Kafka pods. If you check the different services (JMX, Kafka, headless, etc.) you'll find that those ones are parametrised.

On K8s we don't really care much about the ports used on the pod/container, the ones that we do really care and should be customisable are the ones used on services.

Copy link
Copy Markdown
Contributor

@miguelaeh miguelaeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this PR!!!
I left some minor comments, please take a look.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about doing this?:

for i in `seq 1 $retries`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that option better in terms of performance? If there's no "real" reason to change this, I'll keep it as it's.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I am not sure about the performance, as seq require to call an external command, but in the other hand using the normal for it will perform a comparison and an incrementation in every iteration.
Anyway, I don't think this kind of performance is worrying here, I just suggest it because it is cleaner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't consider it a "cleaner" solution. I think it's very subjective statement. Anyway, I don't think it's something important.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no problem, it was just my opinion but there is nothing wrong in have it as it is.

juan131 added 5 commits March 23, 2020 13:41
…ing external ips/ports

Signed-off-by: juan131 <juan@bitnami.com>
Signed-off-by: juan131 <juan@bitnami.com>
Signed-off-by: juan131 <juan@bitnami.com>
Signed-off-by: juan131 <juan@bitnami.com>
Signed-off-by: juan131 <juan@bitnami.com>
@juan131 juan131 force-pushed the kafka-external-access branch from 4ed102c to 60595fa Compare March 23, 2020 13:01
Copy link
Copy Markdown
Contributor

@rafariossaa rafariossaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Bitnami Containers <containers@bitnami.com>
@bitnami-bot
Copy link
Copy Markdown
Contributor

I have just updated the bitnami images with the latest known immutable tags:

  • "docker.io/bitnami/kafka:2.4.1-debian-10-r12"
  • "docker.io/bitnami/jmx-exporter:0.12.0-debian-10-r54"
  • "docker.io/bitnami/kafka-exporter:1.2.0-debian-10-r55"
  • "docker.io/bitnami/minideb:buster"

Copy link
Copy Markdown
Contributor

@miguelaeh miguelaeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@juan131 juan131 merged commit e85995f into bitnami:master Mar 23, 2020
@juan131 juan131 deleted the kafka-external-access branch March 23, 2020 18:16
{{- else if $root.Values.externalAccess.autoDiscovery.enabled }}
targetPort: null
{{- else }}
targetPort: {{ index $root.Values.externalAccess.service.nodePort $i }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,

The value in values.yaml and values-production.yaml is nodePorts, but here is nodePort.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 42

secretKeyRef:
name: {{ if .Values.auth.existingSecret }}{{ .Values.auth.existingSecret }}{{ else }}{{ template "kafka.fullname" . }}{{ end }}
name: {{ include "kafka.secretName" . }}
key: kafka-zookeeper-password
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,

If I set auth.existingSecret but not auth.zookeeperPassword in values-producation.yaml, the KAFKA_ZOOKEEPER_PASSWORD won't be enabled. I think the expected behavior is that either (auth.zookeeperPassword exist) or (auth.existingSecret exist and kafka-zookeeper-password is in the secret ) should enable the value KAFKA_ZOOKEEPER_PASSWORD

@oranje42
Copy link
Copy Markdown

oranje42 commented Mar 26, 2020

Hi,

I just installed the latest version of bitnami/kafka that also contains the changes from this pull-request into a Kubernetes 1.15 cluster, with metrics and serviceMonitor enabled:

metrics:
    jmx:
      enabled: true
    kafka:
      enabled: true
    serviceMonitor:
      enabled: true

However, when looking at my Prometheus targets, I get the following:

kafka/kafka-jmx-metrics/0 (0/0 up) 
kafka/kafka-metrics/0 (0/0 up)

The serviceMonitors are discovered as expected, but the endpoints aren't (and hence no metrics get collected).

It seems that changing the port names from metrics to http-metrics within both services (jmx-metrics-svc.yaml and kafka-metrics-svc.yaml) as done by this pull-request is causing that issue. If I change the port names to http-metrics also for the ServiceMonitors in servicemonitor-metrics.yamland servicemonitor-jmx-metrics.yaml for my own deployment, the endpoints get correctly discovered again by Prometheus.

Any ideas on this? Thanks!

@juan131
Copy link
Copy Markdown
Contributor Author

juan131 commented Mar 26, 2020

Hi @oranje42

Thanks so much for reporting this bug! You're right and we need to update the port names in the servicemonitor-*. Fixing this at #2145

@oranje42
Copy link
Copy Markdown

Wow, that was pretty fast! Thank you!
😃

@juan131
Copy link
Copy Markdown
Contributor Author

juan131 commented Mar 27, 2020

You're welcome @oranje42 ! 😃

alvneiayu pushed a commit that referenced this pull request Nov 13, 2025
…ions (#2098)

Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants