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

Error: failed to generate container "xxx" spec: failed to generate spec: failed to mkdir "/data": mkdir /data: read-only file system #3383

Open
cyberstackover opened this issue May 15, 2024 · 0 comments

Comments

@cyberstackover
Copy link

hello, I found a problem with an error like this in Kubernetes. this is my yaml

redisinsight.yaml

apiVersion: v1
kind: Service
metadata:
  name: redisinsight-service
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 5540
  selector:
    app: redisinsight

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: redisinsight-pv-claim
  labels:
    app: redisinsight
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
  storageClassName: standart

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redisinsight
  labels:
    app: redisinsight
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: redisinsight
  template:
    metadata:
      labels:
        app: redisinsight
    spec:
      volumes:
        - name: redisinsight
          persistentVolumeClaim:
            claimName: redisinsight-pv-claim
      initContainers:
        - name: init
          image: busybox
          command:
            - "sh"
            - "-c"
            - "mkdir -p /data && chown -R 1000 /data"
          resources: {}
          volumeMounts:
            - name: redisinsight
              mountPath: /data
      containers:
        - name: redisinsight
          image: redis/redisinsight:latest
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - name: redisinsight
              mountPath: /data
          ports:
            - containerPort: 5540
              protocol: TCP

redisinsight-pv.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: redisinsight-pv
spec:
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: standart
  hostPath:
    path: "/data"

error :

Warning Failed 5m18s kubelet Error: failed to generate container "63b59189270b2d2da9498dd08c5de3de4311afc23380c15b55dff7b4eca5aa90" spec: failed to generate spec: failed to mkdir "/data": mkdir /data: read-only file system

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

1 participant