Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

[incubator/kafka] Support option to expose Kafka via NodePort - #3754

Merged
k8s-ci-robot merged 1 commit into
masterfrom
unknown repository
Mar 2, 2018
Merged

k8s-ci-robot merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 16, 2018 •

Copy link
Copy Markdown

README.md excerpt:

Connecting to Kafka from outside Kubernetes

Review and optioanlly override to enable the example text concerned with external access in values.yaml.

Once configured, you should be able to reach Kafka via NodePorts, one per replica. In kops where private, topology is enabled, this feature publishes an internal round-robin DNS record using the following naming scheme. The external access feature of this chart was tested with kops on AWS using flannel networking. If you wish to enable external access to Kafka running in kops, your security groups will likely need to be adjusted to allow non-Kubernetes nodes (e.g. bastion) to access the Kafka external listener port range.

{{ .Release.Name }}.{{ .Values.external.domain }}

Port numbers for external access used at container and NodePort are unique to each container in the StatefulSet. Using the default external.firstListenerPort number with a replicas value of 3, the following container and NodePorts will be opened for external access: 31090, 31091, 31092. All of these ports should be reachable from any host to NodePorts are exposed because Kubernetes routes each NodePort from entry node to pod/container listening on the same port (e.g. 31091).

The external.servicePort at each external access service (one such service per pod) is a relay toward
the a containerPort with a number matching its respective NodePort. The range of NodePorts is set, but should not actually listen, on all Kafka pods in the StatefulSet. As any given pod will listen only one such port at a time, setting the range at every Kafka pod is a reasonably safe configuration.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 16, 2018
@ghost

ghost commented Feb 16, 2018

Copy link
Copy Markdown
Author

/assign @mattfarina

@ghost ghost changed the title Support option to expose Kafka via NodePort [incubator/kafka] Support option to expose Kafka via NodePort Feb 22, 2018
@ghost

ghost commented Feb 22, 2018

Copy link
Copy Markdown
Author

/assign @unguiculus

@unguiculus

Copy link
Copy Markdown
Member

@benjigoldberg benjigoldberg left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@josdotso This is a huge step for this chart! Thanks for doing this work. I can think of a number of people who will be thrilled that external access is now an option.

One question about image tags.

The init container/pod selector game is a bit amusing, but really Kubernetes doesnt give many other options. I attempted this same functionality with nginx-ingress/headless service/TCP exposure but never had much luck, I think mostly due to kafka configurations which you appear to have nailed in your config. Lovely to see this configuration though -- it involves far fewer moving parts than other attempts that I have seen!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a better image tag by any chance?

@eicnix eicnix Feb 27, 2018 •

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.

Shouldn't the image also be configureable? Otherwise people that cannot download from docker hub are unable to use this feature.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed on both points. I'll fix this ASAP. Thanks!!!

Comment thread incubator/kafka/README.md Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Note to self: typo ^

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@benjigoldberg , @eicnix : Please take another look. I believe I've addressed all concerns above.

@jdumars

jdumars commented Mar 2, 2018

Copy link
Copy Markdown

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 2, 2018
@benjigoldberg

Copy link
Copy Markdown
Collaborator

LGTM

@unguiculus

Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 2, 2018
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: josdotso, unguiculus

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 2, 2018
@k8s-ci-robot
k8s-ci-robot merged commit 603abee into helm:master Mar 2, 2018
@piter42zx

Copy link
Copy Markdown

Hi,

First of all, thanks a lot for this!

I installed the chart locally in a minikube with the external access enabled and configured "advertised.listeners": |-
EXTERNAL://192.168.99.100:$((31090 + ${KAFKA_BROKER_ID}))
where 192.168.99.100 is the ip of the minikube.

My objective is to access the Kafka broker from outside the K8s cluster.

I used port-forward on the zookeeper pod and successfully created the topic test1 (as explained in the chart notes).

However, when I try to create a message using the following command to start an interactive message producer session I get the error shown below:
kafka-console-producer --broker-list 192.168.99.100:31090 --topic test1

WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

Am I missing some configuration?

Thanks in advance!

@benjigoldberg

Copy link
Copy Markdown
Collaborator

@josdotso I havent used the external config yet personally, any advice you can offer to @piter42zx?

@ghost

ghost commented Mar 21, 2018 •

Copy link
Copy Markdown
Author

@piter42zx : Thanks for the bug report!

See: #4400

cc: @benjigoldberg

ichtar pushed a commit to Bestmile/charts that referenced this pull request May 15, 2018
voron pushed a commit to dysnix/helm-charts that referenced this pull request Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants