我正在尝试在Kubernetes集群上部署GLPI应用程序(http://glpi-project.org/),但是遇到问题。

这是我的部署代码:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pv-claim-glpi
  labels:
    type: openebs
spec:
  storageClassName: openebs-storageclass
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: glpi
  namespace: jb
  labels:
    app: glpi
spec:
  selector:
    matchLabels:
      app: glpi
  replicas: 1 # tells deployment to run 1 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      # unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
      # generated from the deployment name
      labels:
        app: glpi
    spec:
      volumes:
      - name: pv-storage-glpi
        persistentVolumeClaim:
          claimName: pv-claim-glpi
      containers:
      - name: mariadb
        image: mariadb
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "glpi"
        - name: MYSQL_DATABASE
          value: "glpi"
        - name: MYSQL_USER
          value: "glpi"
        - name: MYSQL_PASSWORD
          value: "glpi"
        - name: GLPI_SOURCE_URL
          value: "https://forge.glpi-project.org/attachments/download/2020/glpi-0.85.4.tar.gz"
        ports:
        - containerPort: 3306
          name: mariadb
        volumeMounts:
        - mountPath: /var/lib/mariadb/
          name: pv-storage-glpi
          subPath: mariadb
      - name: glpi
        image: driket54/glpi
        ports:
        - containerPort: 80
          name: http
        - containerPort: 8090
          name: https
        volumeMounts:
        - mountPath: /var/glpidata
          name: pv-storage-glpi
          subPath: glpidata
---
apiVersion: v1
kind: Service
metadata:
  name: glpi
  namespace: jb
spec:
  selector:
    app: glpi
  ports:
  - protocol: "TCP"
    port: 80
    targetPort: http
    name: http
  - protocol: "TCP"
    port: 8090
    targetPort: https
    name: https
  - protocol: "TCP"
    port: 3306
    targetPort: mariadb
    name: mariadb
  type: NodePort
---

docker镜像已正确部署,但是在我的测试阶段,在应用程序的安装过程中,设置数据库(mysql)时出现以下错误。

docker - Kubernetes部署数据库连接错误-LMLPHP

我已经检查过凭据(主机,用户名,密码),并且正确

请帮忙

最佳答案

由于我还没有Kubernetes知识,所以这不是一个真正的答案,但是我还不能添加评论:(

首先应该更改的是GLPi版本。
使用此链接。这是最后一个:
https://github.com/glpi-project/glpi/releases/download/9.3.0/glpi-9.3.tgz

然后,您可以使用cli工具来设置数据库。
https://glpi-install.readthedocs.io/en/latest/command-line.html

使用我从您的文件中得到的信息:

php scripts/cliinstall.php --host=mariadb(not sure about this one in your environment but you get hte idea) --db=glpi --user=glpi --pass=glpi

08-26 23:07