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

How to setup properly kubernetes with kafka #651

Open
igortas opened this issue Apr 18, 2021 · 1 comment
Open

How to setup properly kubernetes with kafka #651

igortas opened this issue Apr 18, 2021 · 1 comment

Comments

@igortas
Copy link

igortas commented Apr 18, 2021

Hi,
How I can setup properly kafka with kubernetes?

---
apiVersion: v1
kind: Service
metadata:
  name: zoo1
  labels:
    app: zoo1
spec:
  ports:
    - name: client
      port: 2181
      protocol: TCP
    - name: follower
      port: 2888
      protocol: TCP
    - name: leader
      port: 3888
      protocol: TCP
  selector:
    app: zoo1
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-service
  labels:
    name: kafka
spec:
  ports:
    - port: 9092
      name: kafka-port
      protocol: TCP
  selector:
    app: kafka
    id: "0"
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: zoo1
spec:
  selector:
    matchLabels:
      app: zoo1
  template:
    metadata:
      labels:
        app: zoo1
    spec:
      containers:
        - name: zoo1
          image: digitalwonderland/zookeeper
          ports:
            - containerPort: 2181
          env:
            - name: ZOOKEEPER_ID
              value: "1"
            - name: ZOOKEEPER_SERVER_1
              value: zoo1
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: kafka
spec:
  selector:
    matchLabels:
      app: kafka
  template:
    metadata:
      labels:
        app: kafka
        id: "0"
    spec:
      containers:
        - name: kafka
          image: wurstmeister/kafka
          ports:
            - containerPort: 9092
          env:
            - name: KAFKA_ADVERTISED_PORT
              value: "9092"
            - name: KAFKA_ADVERTISED_HOST_NAME
              value: kafka-service
            - name: KAFKA_ZOOKEEPER_CONNECT
              value: zoo1:2181
            - name: KAFKA_BROKER_ID
              value: "0"
            - name: KAFKA_CREATE_TOPICS
              value: "topic:1:1"
---

I'm getting error: 'There is no leader for this topic-partition as we are in the middle of a leadership election'.

But I think the real issues is misconfiguration.

Br,

@OneCricketeer
Copy link

If you don't care about what images are actually used, you can try with https://strimzi.io instead

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

2 participants