yandex-cloud / k8s-csi-s3

GeeseFS-based CSI for mounting S3 buckets as PersistentVolumes
Other
540 stars 95 forks source link

pvc error ‘chown: changing ownership of '/var/lib/mysql/': Operation not supported’ #111

Closed limityu closed 3 months ago

limityu commented 5 months ago

After pvc is mounted to the pod, commands such as chown are not supported, causing Mysql to fail to start. version: 0.40.3

# storageclass create
git clone https://github.com/yandex-cloud/k8s-csi-s3
cd k8s-csi-s3/deploy/kubernetes/ deploy/kubernetes
kubectl create -f provisioner.yaml
kubectl create -f driver.yaml
kubectl create -f csi-s3.yaml
# Create PVC and test mysql
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pvc
  namespace: test
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: csi-s3
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-deployment
  namespace: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - name: mysql
          image: mysql:latest
          ports:
            - containerPort: 3306
          env:
            - name: MYSQL_ROOT_PASSWORD
              value: "root"
          volumeMounts:
            - name: mysql-volume
              mountPath: /var/lib/mysql
      volumes:
        - name: mysql-volume
          persistentVolumeClaim:
            claimName: mysql-pvc
# Observe mysql status
kubectl -n test get pods mysql-deployment-6cdbf6cdc8-8k5hq 
NAME                                READY   STATUS             RESTARTS      AGE
mysql-deployment-6cdbf6cdc8-8k5hq   0/1     CrashLoopBackOff   7 (69s ago)   15m

2024-04-25 02:12:16+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
chown: changing ownership of '/var/lib/mysql/': Operation not supported
limityu commented 5 months ago

storageclass create is marked incorrectly, it is actually

cd k8s-csi-s3/deploy/kubernetes/
kubectl create -f provisioner.yaml
kubectl create -f driver.yaml
kubectl create -f csi-s3.yaml
dyrnq commented 3 months ago
limityu commented 3 months ago

Thank you for your reply, the problem has been solved. In the storageClass in the examples, the options field lacks the '-o allow_other --uid 999 --gid 999' configuration, which has been solved after adding it