我试图在traefik后面配置kafka集群,但是我的生产者和客户机(在kubernetes之外)没有连接到引导服务器。他们一直在说:
“给定url中没有可解析的引导服务器”
实际上这里是traefik入口:
{
"apiVersion": "extensions/v1beta1",
"kind": "Ingress",
"metadata": {
"name": "nppl-ingress",
"annotations": {
"kubernetes.io/ingress.class": "traefik",
"traefik.frontend.rule.type": "PathPrefixStrip"
}
},
"spec": {
"rules": [
{
"host": "" ,
"http": {
"paths": [
{
"path": "/zuul-gateway",
"backend": {
"serviceName": "zuul-gateway",
"servicePort": "zuul-port"
}
},
{
"path": "/kafka",
"backend": {
"serviceName": "kafka-broker",
"servicePort": "kafka-port"
}
[..]
}
我给Kafka消费者/生产者的是traefik的公共ip。下面是流程:[kafka producers/consumers]->traefik(作为负载均衡器公开)->[kafka cluster]
有什么解决办法吗?否则我想添加一个kafka rest代理(https://docs.confluent.io/current/kafka-rest/docs/index.html)但我认为这不是一个理想的解决方案。
1条答案
按热度按时间os8fio9y1#
是的。您可以在kubernetes中引用它,部署kafka.yaml
kafka服务、外部服务调用地址或traefik代理地址
确保kafka外部端口和nodeport端口一致,其他服务调用kafka-com:30322,我的博客写的这个配置Kafka在Kubernetes,希望对你有所帮助!