Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access Kafka outside of Kubernetes #161

Closed
dinoba opened this issue Mar 6, 2018 · 9 comments
Closed

Can't access Kafka outside of Kubernetes #161

dinoba opened this issue Mar 6, 2018 · 9 comments

Comments

@dinoba
Copy link

dinoba commented Mar 6, 2018

I've started Kafka using manifests from /configure, /zookeeper and kafka /kafka directories.

When I run services outside-0 - 3 I don't get any external IP

What am I doing wrong here?

this is my svc listing

NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
svc/bootstrap   ClusterIP   10.108.85.149   <none>        9092/TCP            17h
svc/broker      ClusterIP   None            <none>        9092/TCP            17h
svc/outside-0   NodePort    10.96.121.223   <none>        32400:32400/TCP     12m
svc/outside-1   NodePort    10.102.27.147   <none>        32401:32401/TCP     12m
svc/outside-2   NodePort    10.111.151.46   <none>        32402:32402/TCP     12m
svc/pzoo        ClusterIP   None            <none>        2888/TCP,3888/TCP   20h
svc/zookeeper   ClusterIP   10.109.138.16   <none>        2181/TCP            20h
@dinoba dinoba changed the title Can't access Kafka outsite of Kubernetes Can't access Kafka outside of Kubernetes Mar 6, 2018
@solsson
Copy link
Contributor

solsson commented Mar 6, 2018

You need to change the services to LoadBalancer to get an external IP. Node port requires access to the nodes, on port 32400+ as seen in your svc listing.

You most likely also need to resolve outside listener names, i.e. FQDNs or IP addresses, in https://github.com/Yolean/kubernetes-kafka/blob/v3.1.0/kafka/10broker-config.yml#L30 based on your hosting situation. I think there are examples for AWS in #13 or #78.

@dinoba
Copy link
Author

dinoba commented Mar 8, 2018

I am going over #13 and #78 for days... It is really confusing. Is there any way to get short howto?

@solsson
Copy link
Contributor

solsson commented Mar 9, 2018

Nope, sorry. You're actually on your own. No howto can anticipate how you chose to expose these ports, how load balancing works in your cluster and how a shell script on the inside can figure out these external DNS-names or IP-addresses.

@yoneal
Copy link

yoneal commented Mar 10, 2018

We used external-dns to setup our cluster quickly. You might want to check it out.

@dinoba
Copy link
Author

dinoba commented Mar 12, 2018

Thanks guys... I will try to do something with this. Hopefully it will work, so I can finally switch from Mesos to Kubernetes.

@SamD
Copy link

SamD commented Apr 4, 2018

@dinoba
Depending on your deployment environment it might be a simple change, my current deployment is running k8s on AWS and for testing purposes I had setup a VPC with a public subnet where my cluster is.
In this case the minions will be assigned a public DNS entry by AWS so as mentioned by @solsson , in 10broker-config.yml I was able to change the script setting for OUTSIDE_HOST simply to use ExternalDNS vs InternalIP
e.g.

OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="ExternalDNS")].address}')

After doing so my external clients worked correctly

@maykiwo
Copy link

maykiwo commented Jan 4, 2019

Hi @SamD
I'm working on Google GKE.
I've setup the same command but use "ExternalIP"

So in the server.properties of my brokers, i got something like this ::
advertised.listeners=OUTSIDE://x.x.x.156:32401,PLAINTEXT://:9092

When I'm trying to acces from the outside service with this port, i get TIMED OUT

node-1# curl x.x.x.156:32401
*** port 32401: Connection timed out

gcloudShell# curl x.x.x.156:32401
*** port 32401: Connection timed out

What's wrong ?

Thanks for help.

@SamD
Copy link

SamD commented Jan 5, 2019

@maykiwo I haven't looked at this in a long time and haven't actually been working with k8s for sometime now. What shows in the in kubectl node addresses? Whatever you need should be in there so just substitute the correct type for ExternalDNS in the OUTPUT_HOST set script I specified and it should work.

@maykiwo
Copy link

maykiwo commented Jan 8, 2019

@SamD, I'll try it. Thanks for reply.

@dinoba dinoba closed this as completed Mar 16, 2023
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

No branches or pull requests

5 participants