如何连接到kubernetes集群中的kafka示例?

lf5gs5x2  于 2021-06-06  发布在  Kafka
关注(0)|答案(1)|浏览(524)

我刚刚使用rancher部署了一个kubernetes集群,并使用rancher的云应用程序部署了kafka(如果我是正确的,它使用的是helm图表)。不幸的是,我无法从外部连接到它。我刚创建了一个入口指向 kafka-dtxkf-kafka 在端口9092上服务。但是,它仍然无法连接。
我的群集如下:

NAME                                               READY     STATUS    RESTARTS   AGE
pod/kafka-dtxkf-kafka-0                            1/1       Running   0          13m
pod/kafka-dtxkf-kafka-1                            1/1       Running   0          13m
pod/kafka-dtxkf-kafka-2                            1/1       Running   1          13m
pod/kafka-dtxkf-kafka-rest-85d899545f-jzq4g        1/1       Running   1          13m
pod/kafka-dtxkf-kafka-topics-ui-654d9c455d-pw74m   1/1       Running   0          13m
pod/kafka-dtxkf-schema-registry-6c54bdf8c4-ktjkg   1/1       Running   5          13m
pod/kafka-dtxkf-zookeeper-0                        1/1       Running   0          13m
pod/kafka-dtxkf-zookeeper-1                        1/1       Running   0          13m
pod/kafka-dtxkf-zookeeper-2                        1/1       Running   0          13m

NAME                                               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/ingress-aef7dfa8ffc7dc6099c8c10a74d8e962   ClusterIP   10.43.219.128   <none>        9092/TCP                     3m
service/kafka-dtxkf-kafka                          ClusterIP   10.43.241.160   <none>        9092/TCP                     13m
service/kafka-dtxkf-kafka-headless                 ClusterIP   None            <none>        9092/TCP                     13m
service/kafka-dtxkf-kafka-rest                     ClusterIP   10.43.134.186   <none>        8082/TCP                     13m
service/kafka-dtxkf-kafka-topics-ui                NodePort    10.43.210.62    <none>        8000:31547/TCP               13m
service/kafka-dtxkf-schema-registry                ClusterIP   10.43.101.213   <none>        8081/TCP                     13m
service/kafka-dtxkf-zookeeper                      ClusterIP   10.43.242.136   <none>        2181/TCP                     13m
service/kafka-dtxkf-zookeeper-headless             ClusterIP   None            <none>        2181/TCP,2888/TCP,3888/TCP   13m
service/kubernetes                                 ClusterIP   10.43.0.1       <none>        443/TCP                      1d

NAME                                          DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/kafka-dtxkf-kafka-rest        1         1         1            1           13m
deployment.apps/kafka-dtxkf-kafka-topics-ui   1         1         1            1           13m
deployment.apps/kafka-dtxkf-schema-registry   1         1         1            1           13m

NAME                                                     DESIRED   CURRENT   READY     AGE
replicaset.apps/kafka-dtxkf-kafka-rest-85d899545f        1         1         1         13m
replicaset.apps/kafka-dtxkf-kafka-topics-ui-654d9c455d   1         1         1         13m
replicaset.apps/kafka-dtxkf-schema-registry-6c54bdf8c4   1         1         1         13m

NAME                                     DESIRED   CURRENT   AGE
statefulset.apps/kafka-dtxkf-kafka       3         3         13m
statefulset.apps/kafka-dtxkf-zookeeper   3         3         13m

我的入口配置:

kubectl描述服务/入口-aef7dfa8ffc7dc6099c8c10a74d8e962:

Name:              ingress-aef7dfa8ffc7dc6099c8c10a74d8e962
    Namespace:         default
    Labels:            cattle.io/creator=norman
    Annotations:       field.cattle.io/targetWorkloadIds=["statefulset:default:kafka-dtxkf-kafka"]
    Selector:          workloadID_ingress-aef7dfa8ffc7dc6099c8c10a74d8e962=true
    Type:              ClusterIP
    IP:                10.43.219.128
    Port:              <unset>  9092/TCP
    TargetPort:        9092/TCP
    Endpoints:         10.42.0.111:9092,10.42.1.83:9092,10.42.1.84:9092
    Session Affinity:  None
    Events:            <none>
xmq68pz9

xmq68pz91#

我认为负载均衡器只导出http/https流量,对于kafka您可以使用tcp服务https://github.com/rancher/rancher/issues/14744

相关问题