【问题标题】:Nextcloud Kubernetes deployment Internal server errorNextcloud Kubernetes部署内部服务器错误
【发布时间】:2020-09-15 16:25:31
【问题描述】:

我想根据本指南在 kubernetes 中安装 nextcloud:https://www.codementor.io/@alicheaito/deploying-nextcloud-on-kubernetes-with-kustomize-tn78vcz0a

我不使用任何入口。为了进行测试,我在部署时使用了 RunAsUser: 0,我知道这不安全,我将在生产中将其更改为端口 8080 和用户 ID 1099。当我调用页面时,我得到这个屏幕:

我在日志中没有看到任何可疑之处:

我是 Kubernetes 新手,不知道从哪里开始调试。

我的 nextcloud 的 deployment.yaml:

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

nextcloud 的 service.yaml:

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

来自服务和 pod 的屏幕截图:

这是 nextcloud.log 文件有一些可疑的东西,但这对我没有帮助:

{"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":""}

【问题讨论】:

  • 你能编辑你的问题吗?它没有日志图像,而是文本?我们很难使用它。

标签: kubernetes nextcloud kubernetes-deployment


【解决方案1】:

让我解决您问题中的“我不知道从哪里开始调试”部分,因为我相信从长远来看,这将是对您最有益的方法。

有两个最常见的调试内容也适用于您的用例:

Debug Services 通过检查:

  • 服务是否存在?

  • 服务是否通过 DNS 名称工作?

  • 服务是否通过 IP 工作?

  • 服务定义正确吗?

  • 服务有端点吗?

  • kube-proxy 工作正常吗?

Debug Running Pods 解释了如何调试在节点上运行(或崩溃)的 Pod:

  • 检查 pod 日志

  • 使用容器 exec 进行调试

  • 使用临时调试容器进行调试

  • 通过节点上的 shell 进行调试

我还建议您阅读Troubleshoot Applications 指南:

本指南旨在帮助用户调试部署到 Kubernetes 并且行为不正确。

可以在链接的来源中找到步骤和详细信息。

了解上述方法将帮助您了解首先从 Kubernetes 方面检查的位置和内容。我希望你会发现它有用。

【讨论】:

    猜你喜欢
    • 2015-11-23
    • 1970-01-01
    • 2020-07-06
    • 2018-11-15
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多