geerlingguy / pi-cluster

Raspberry Pi Cluster automation
MIT License
465 stars 46 forks source link

Make ReadWriteMany work without nfs. #4

Closed steveiliop56 closed 1 year ago

steveiliop56 commented 1 year ago

Hi!

I recently built my first k3s cluster with my one pi4 and wanted to install drupal ( because its awesome :) ) so with the help of chatGPT and your drupal.yml I created this manifest file ( Note that the volume that I want must be mounted in /data/drupal-files/ on the raspberry pi and in /var/www/html on the container. ):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drupal-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: drupal
  template:
    metadata:
      labels:
        app: drupal
    spec:
      containers:
        - name: drupal
          image: drupal:latest
          ports:
            - name: http
              containerPort: 80
          volumeMounts:
            - name: drupal-files
              mountPath: /var/www/html
      volumes:
        - name: drupal-files
          persistentVolumeClaim:
            claimName: drupal-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: drupal-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: drupal-service
spec:
  ports:
    - name: http
      port: 7000
      targetPort: 80
  selector:
    app: drupal
  type: LoadBalancer

But while the pods and the service work, the persistent volume claim does not want to start, it's stuck on pending. When I run sudo kubectl describe pvc it gives me this output:

Name:          drupal-pvc
Namespace:     default
StorageClass:  local-path
Status:        Pending
Volume:
Labels:        <none>
Annotations:   volume.beta.kubernetes.io/storage-provisioner: rancher.io/local-path
               volume.kubernetes.io/selected-node: raspberrypi4
               volume.kubernetes.io/storage-provisioner: rancher.io/local-path
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       drupal-deployment-8b48bb9cb-2x6bs
               drupal-deployment-8b48bb9cb-dffqb
Events:
  Type    Reason                Age               From                         Message
  ----    ------                ----              ----                         -------
  Normal  WaitForFirstConsumer  10s               persistentvolume-controller  waiting for first consumer to be created before binding
  Normal  ExternalProvisioning  2s (x2 over 10s)  persistentvolume-controller  waiting for a volume to be created, either by external provisioner "rancher.io/local-path" or manually created by system administrator

I tried creating a volume mapped to /data/drupal-files but it still does not work. Lastly I want to note that the ReadWriteOnce mode works fine.

Thanks in advance, RaspberryDeveloper :)

stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.