kow3ns / kubernetes-kafka

Kafka integration for Kubernetes
Apache License 2.0
82 stars 71 forks source link

Newbie question #4

Open EricVS opened 6 years ago

EricVS commented 6 years ago

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.

sibtainabbas10 commented 6 years ago

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

EricVS commented 6 years ago

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.