Nextcloud Kubernetes deployment Internal server error

5/28/2020

I want to install nextcloud in kubernetes according to this guide: https://www.codementor.io/@alicheaito/deploying-nextcloud-on-kubernetes-with-kustomize-tn78vcz0a

I don't use any ingress. For testing I used RunAsUser: 0 at the deployment, I know this is not secure, and I will change it to port 8080 and user id 1099 in production. When I call the page I get this screen:  Internal server error

I don't see anything suspecting in the logs: enter image description here

I am new to kubernetes, and I don't know where to begin to debug.

My deployment.yaml for nextcloud:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    component: app
  name: app
spec:
  selector:
    matchLabels:
      component: app
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        component: app
    spec:
      securityContext:
        fsGroup: 1099
        runAsUser: 33
        runAsGroup: 1099
      containers:
        - image: nextcloud:apache
          imagePullPolicy: Always
          name: app
          ports:
            - containerPort: 80
          env:
            - name: MYSQL_DATABASE
              valueFrom:
                secretKeyRef:
                  key: MYSQL_DATABASE
                  name: db-secrets
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: MYSQL_PASSWORD
                  name: db-secrets
            - name: MYSQL_USER
              valueFrom:
                secretKeyRef:
                  key: MYSQL_USER
                  name: db-secrets
          volumeMounts:
            - mountPath: /var/www/html
              name: app-persistent-storage
            - mountPath: /usr/local/etc/php/conf.d/
              name: app-persistent-storage
      restartPolicy: Always
      volumes:
        - name: app-persistent-storage
          persistentVolumeClaim:
            claimName: app-pvc

The service.yaml for nextcloud:

apiVersion: v1
kind: Service
metadata:
  name: app
  labels:
    component: app
spec:
  type: LoadBalancer
  ports:
    - port: 80
  selector:
    component: app

Screenshots from services and pods: kubectl get svc enter image description here

Here is the nextcloud.log file there is something suspicious, but that didn't help me:

{"reqId":"4cSKDj718CckiPwauoRU","level":3,"time":"2020-05-28T11:00:55+00:00","remoteAddr":"10.20.0.8","user":"--","app":"base","method":"GET","url":"/","message":{"Exception":"Exception","Message":"Failed to start session","Code":0,"Trace":[{"file":"/var/www/html/lib/base.php","line":429,"function":"__construct","class":"OC\\Session\\Internal","type":"->","args":["oci0uf3awll8"]},{"file":"/var/www/html/lib/base.php","line":647,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1089,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":36,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Session/Internal.php","Line":65,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36","version":""}
{"reqId":"4cSKDj718CckiPwauoRU","level":3,"time":"2020-05-28T11:00:56+00:00","remoteAddr":"10.20.0.8","user":"--","app":"PHP","method":"GET","url":"/","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/html/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36","version":""}
-- Dominik2000
kubernetes
kubernetes-deployment
nextcloud

0 Answers