Using WORDPRESS_DB_HOST variable Cannot connect to the database, must be configu
-
I use kubernetes to run wordpress, and configure the WORDPRESS_DB_HOST variable, but it can not connect to the database, manually configure the database IP can be, mast have i to manually configure?
apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nginx name: nginx spec: replicas: 1 selector: matchLabels: app: nginx strategy: {} template: metadata: creationTimestamp: null labels: app: nginx spec: containers: - image: nginx:v1.24.0 name: nginx ports: - containerPort: 80 resources: {} --- apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: mysql name: mysql spec: replicas: 1 selector: matchLabels: app: mysql strategy: {} template: metadata: creationTimestamp: null labels: app: mysql spec: containers: - image: mysql:v8.0.33 name: mysql env: - name: MYSQL_ROOT_PASSWORD value: 2Grm-JFJ - name: MYSQL_DATABASE value: wordpress - name: MYSQL_USER value: wordpress - name: MYSQL_PASSWORD value: 2Grm-JFJ resources: {} --- apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: wordpress-php name: wordpress-php spec: replicas: 1 selector: matchLabels: app: wordpress-php strategy: {} template: metadata: creationTimestamp: null labels: app: wordpress-php spec: containers: - image: wordpress:php8.2 name: wordpress-php env: - name: WORDPRESS_DB_HOST value: mysql-service - name: WORDPRESS_DB_USER value: wordpress - name: WORDPRESS_DB_PASSWORD value: 2Grm-JFJ - name: WORDPRESS_DB_NAME value: wordpress resources: {} status: {} --- apiVersion: v1 kind: Service metadata: labels: app: nginx name: nginx namespace: default spec: ports: - name: tcp nodePort: 31000 port: 80 protocol: TCP targetPort: 80 selector: app: nginx sessionAffinity: None type: NodePort status: loadBalancer: {} --- apiVersion: v1 kind: Service metadata: labels: app: mysql name: mysql-service namespace: default spec: clusterIP: 10.107.80.100 clusterIPs: - 10.107.80.100 internalTrafficPolicy: Cluster ipFamilies: - IPv4 ipFamilyPolicy: SingleStack ports: - name: tcp port: 3306 protocol: TCP targetPort: 3306 selector: app: mysql sessionAffinity: None type: ClusterIP status: loadBalancer: {} --- apiVersion: v1 kind: Service metadata: labels: app: wordpress-php name: wordpress-service namespace: default spec: clusterIP: 10.107.80.102 clusterIPs: - 10.107.80.102 internalTrafficPolicy: Cluster ipFamilies: - IPv4 ipFamilyPolicy: SingleStack ports: - name: tcp port: 80 protocol: TCP targetPort: 80 selector: app: wordpress-php sessionAffinity: None type: ClusterIP status: loadBalancer: {}
查看 1 回复 - 1 至 1 (总计 1)
查看 1 回复 - 1 至 1 (总计 1)
- 话题 ‘Using WORDPRESS_DB_HOST variable Cannot connect to the database, must be configu’不再接受新回复。