diff options
author | Staffan Olsson <staffan@repos.se> | 2017-10-15 12:52:24 +0200 |
---|---|---|
committer | Staffan Olsson <staffan@repos.se> | 2017-10-15 13:09:43 +0200 |
commit | dd9ce9533684492e80c45de9c48f38e168fd7840 (patch) | |
tree | c0f272eff4cc37673a13b55f90fba870c8a8b4f2 /10broker-config.yml | |
parent | c92d50cc6822861e0bc6951ef82a032f6992483f (diff) | |
download | kubernetes-kafka-dd9ce9533684492e80c45de9c48f38e168fd7840.tar.gz kubernetes-kafka-dd9ce9533684492e80c45de9c48f38e168fd7840.tar.bz2 kubernetes-kafka-dd9ce9533684492e80c45de9c48f38e168fd7840.zip |
Exemplifies external access using host lookup that works with minikube
Listener ports from https://hub.docker.com/r/wurstmeister/kafka/
Config based on KIP-103
Diffstat (limited to '10broker-config.yml')
-rw-r--r-- | 10broker-config.yml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/10broker-config.yml b/10broker-config.yml index 6e43e06..b899401 100644 --- a/10broker-config.yml +++ b/10broker-config.yml @@ -24,6 +24,14 @@ data: fi kubectl -n $POD_NAMESPACE label pod $POD_NAME kafka-broker-id=$KAFKA_BROKER_ID + + OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}') + if [ $? -ne 0 ]; then + echo "Outside (i.e. cluster-external access) host lookup command failed" + else + OUTSIDE_HOST=${OUTSIDE_HOST}:3240${KAFKA_BROKER_ID} + sed -i "s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}|" /etc/kafka/server.properties + fi } server.properties: |- @@ -63,14 +71,18 @@ data: # EXAMPLE: # listeners = PLAINTEXT://your.host.name:9092 #listeners=PLAINTEXT://:9092 + listeners=OUTSIDE://:9094,PLAINTEXT://:9092 # Hostname and port the broker will advertise to producers and consumers. If not set, # it uses the value for "listeners" if configured. Otherwise, it will use the value # returned from java.net.InetAddress.getCanonicalHostName(). #advertised.listeners=PLAINTEXT://your.host.name:9092 + #init#advertised.listeners=OUTSIDE://#init#,PLAINTEXT://:9092 # Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL + listener.security.protocol.map=OUTSIDE:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL + inter.broker.listener.name=PLAINTEXT # The number of threads that the server uses for receiving requests from the network and sending responses to the network num.network.threads=3 |