kubernetes-kafka icon indicating copy to clipboard operation
kubernetes-kafka copied to clipboard

Newbie question

Open EricVS opened this issue 7 years ago • 2 comments

Hi, I'm trying to use your template to setup Kafka/Zookeeper on Kubernetes but am having a hard time understanding the link between PersistentVolume and volumeClaimTemplates. Would you mind commenting on how to create the PersistentVolume pointing to a local path? I have this setup, but when I apply your manifest I get the error below...

apiVersion: v1
kind: PersistentVolume
metadata:
  name: datadir
  labels:
    type: local
spec:
  storageClassName: datadir
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/kubernetes/zk/config"

Error is:

PersistentVolumeClaim is not bound: "datadir-zk-0" (repeated 6 times)

and the Persistent Volume Claims stay in pending.

Any help is greatly appreciated.

Kind regards,

Eric V.

EricVS avatar Jan 19 '18 09:01 EricVS

I had the same issue. What I did was I created a PersistentVolume using

kind: PersistentVolume
apiVersion: v1
metadata:
  name: kafka-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/home/ec2-user/kafka-data"

Then in the kafka-config i added:

-----------
-----------
        volumeMounts:
        - name: kafka-pv-volume
          mountPath: /var/lib/kafka
-----------
-----------
  volumeClaimTemplates:
  - metadata:
      name: kafka-pv-volume
    spec:
      storageClassName: manual
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 2Gi

Let me know if that helps

sibtainabbas10 avatar Jan 23 '18 06:01 sibtainabbas10

Hi, Thanks for your reply and feedback. I could get it to work with your solution but only on my localhost (Mac with Docker for Mac Beta with Kubernetes) When I tried to deploy on my Kubernetes cluster it failed. I fixed (worked around) by configuring GlusterFS and use that for PersistentVolume. Works like a charm with regards to the storage. Zookeeper running perfectly but still an error when starting up Kafka not being able to get metadata from list (localhost:9093). Did you encounter that too? Kind regards,

Eric V.

EricVS avatar Jan 23 '18 13:01 EricVS