helm / charts

⚠️(OBSOLETE) Curated applications for Kubernetes
Apache License 2.0
15.49k stars 16.82k forks source link

[incubator/kafka] java.io.IOException: Failed to create data directory /opt/kafka/data/logs #22919

Closed seedarren closed 4 years ago

seedarren commented 4 years ago

Describe the bug Using helm chart to deploy kafka but kafka not able to startup and encounter error java.io.IOException: Failed to create data directory /opt/kafka/data/logs

Version of Helm and Kubernetes: Helm version 3.2.1 kubeadm version: &version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:49:29Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

Which chart: incubator/kafka

What happened: Encountered error as followed:

[2020-06-24 01:54:05,234] INFO Log directory /opt/kafka/data/logs not found, creating it. (kafka.log.LogManager)
[2020-06-24 01:54:05,235] ERROR Failed to create or validate data directory /opt/kafka/data/logs (kafka.server.LogDirFailureChannel)
java.io.IOException: Failed to create data directory /opt/kafka/data/logs
    at kafka.log.LogManager$$anonfun$createAndValidateLogDirs$1.apply(LogManager.scala:158)
    at kafka.log.LogManager$$anonfun$createAndValidateLogDirs$1.apply(LogManager.scala:149)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at kafka.log.LogManager.createAndValidateLogDirs(LogManager.scala:149)
    at kafka.log.LogManager.<init>(LogManager.scala:80)
    at kafka.log.LogManager$.apply(LogManager.scala:953)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:237)
    at io.confluent.support.metrics.SupportedServerStartable.startup(SupportedServerStartable.java:114)
    at io.confluent.support.metrics.SupportedKafka.main(SupportedKafka.java:66)
[2020-06-24 01:54:05,239] ERROR Shutdown broker because none of the specified log dirs from /opt/kafka/data/logs can be created or validated (kafka.log.LogManager)

What you expected to happen:

How to reproduce it (as minimally and precisely as possible): Custom setting applied to deploy kafka as follow:

kafka:
  enabled: true
  persistence:
    enabled: true
    size: 2Gi    
    storageClass: standard
  zookeeper:
    enabled: true
  topics:
  # Create SRS topics
  - name: switchOutRequestQueue
    partitions: 1
    replicationFactor: 1
  - name: aplToNalQueue
    partitions: 1
    replicationFactor: 1

Anything else we need to know:

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue is being automatically closed due to inactivity.

nadjahagen commented 3 years ago

I am having the same issue when trying to deploy Kafka using the helm charts by Confluent. Did you find a solution?

nrvmodi commented 3 years ago

I am facing the same issue

nrvmodi commented 3 years ago

Kafka spec is like below `

Source: cp-kafka/templates/statefulset.yaml

apiVersion: apps/v1 kind: StatefulSet metadata: name: kafka-test-cp-kafka labels: app: cp-kafka chart: cp-kafka-0.1.0 release: kafka-test heritage: Helm spec: selector: matchLabels: app: cp-kafka release: kafka-test serviceName: kafka-test-cp-kafka-headless podManagementPolicy: OrderedReady replicas: 3 updateStrategy: type: RollingUpdate template: metadata: labels: app: cp-kafka release: kafka-test annotations: prometheus.io/scrape: "true" prometheus.io/port: "5556" spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution:

`

nrvmodi commented 3 years ago

@seedarren Have you solved this issue?

amitca71 commented 3 years ago

facing same issue... using helm

nrvmodi commented 3 years ago

I have solved this issue by providing

## Optional Container Security context
securityContext:
  runAsUser: 0
miaozhongyin commented 3 years ago

I have solved this issue by providing

## Optional Container Security context
securityContext:
  runAsUser: 0

Thank you for your solutionm, it's fine.