I have problem with run kafka and zookeeper on kubernetes single node, I test with my laptop and it work but I run on private server it show error in kafka pod and I don't know network setting on private server
I use kompose to convert docker-compose file to k8s yaml file
zoo1: Temporary failure in name resolution
How to fix that error?
Thank you
my deployment and service yaml file
kafka1-deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: kafka1
name: kafka1
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: kafka1
spec:
containers:
- env:
- name: KAFKA_ADVERTISED_LISTENERS
value: PLAINTEXT://kafka1:9092
- name: KAFKA_BROKER_ID
value: "1"
- name: KAFKA_LOG4J_LOGGERS
value: kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "1"
- name: KAFKA_ZOOKEEPER_CONNECT
value: zoo1:2181
image: confluentinc/cp-kafka:4.0.0
name: kafka1
ports:
- containerPort: 9092
resources: {}
hostname: kafka1
restartPolicy: Always
status: {}
kafka1-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: kafka1
name: kafka1
spec:
ports:
- name: "9092"
port: 9092
targetPort: 9092
selector:
io.kompose.service: kafka1
status:
loadBalancer: {}
zoo1-deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: zoo1
name: zoo1
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: zoo1
spec:
containers:
- env:
- name: ZOO_MY_ID
value: "1"
- name: ZOO_PORT
value: "2181"
- name: ZOO_SERVERS
value: server.1=zoo1:2888:3888
image: zookeeper:3.4.9
name: zoo1
ports:
- containerPort: 2181
resources: {}
hostname: zoo1
restartPolicy: Always
status: {}
zoo1-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: zoo1
name: zoo1
spec:
ports:
- name: "2181"
port: 2181
targetPort: 2181
selector:
io.kompose.service: zoo1
status:
loadBalancer: {}
You have to create headless services for kafla and zookeeper
I would recommend to use confluent helm charts to use kafka in kubernetes, you can find how they created headless services.
What are the logs? What's happening exactly?
Hope that's help!