kubernetes部署kafka集群没有外网访问权限
使用k8s部署的kafka集群,没有外网访问权限时添加- name: KAFKA_ADVERTISED_LISTENERSvalue: "PLAINTEXT://[外网ip]:[svc上nodePort端口号]"如下所示---kind: DeploymentapiVersion: apps/v1metadata:name: kafka-deployment-3spec:replicas: 1sel
·
使用k8s部署的kafka集群,没有外网访问权限时
添加
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://[外网ip]:[svc上nodePort端口号]"
如下所示
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: kafka-deployment-3
spec:
replicas: 1
selector:
selector:
matchLabels:
name: kafka-service-3
template:
metadata:
labels:
name: kafka-service-3
app: kafka-service-3
spec:
containers:
- name: kafka-3
image: wurstmeister/kafka
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9092
env:
- name: KAFKA_ADVERTISED_PORT
value: "9092"
- name: KAFKA_ADVERTISED_HOST_NAME
value: 10.0.0.16
- name: KAFKA_ZOOKEEPER_CONNECT
value: zoo1:2181,zoo2:2181,zoo3:2181
- name: KAFKA_BROKER_ID
value: "3"
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://x.x.x.x:30903"
- name: KAFKA_CREATE_TOPICS
value: mytopic:2:1
重新部署
kubectl apply -f …
更多推荐
已为社区贡献1条内容
所有评论(0)