Ghost 博客图表 mysql-c 信息正在尝试连接到 MySQL 服务器

Ghost Blog Chart mysql-c INFO Trying to connect to MySQL server

我收到这个错误:

mysql-c INFO  Trying to connect to MySQL server

所以基本上,去 http://blog.example.com/ghost 显示“服务不可用” 以下是一些日志:

kubectl get events --all-namespaces

NAMESPACE       LAST SEEN   TYPE      REASON                   OBJECT                                                      MESSAGE
example   31m         Warning   Unhealthy                pod/example-blog-ghost-ccf6cb4c4-7p7v6                Readiness probe failed: Get http://10.244.0.105:2368/: dial tcp 10.244.0.105:2368: connect: connection refused
example   26m         Warning   BackOff                  pod/example-blog-ghost-ccf6cb4c4-7p7v6                Back-off restarting failed container
example   <unknown>   Warning   FailedScheduling         pod/example-blog-ghost-ccf6cb4c4-fc94s                0/1 nodes are available: 1 Insufficient cpu, 1 Insufficient memory.
example   <unknown>   Warning   FailedScheduling         pod/example-blog-ghost-ccf6cb4c4-fc94s                0/1 nodes are available: 1 Insufficient cpu, 1 Insufficient memory.
example   <unknown>   Warning   FailedScheduling         pod/example-blog-ghost-ccf6cb4c4-fc94s                running "VolumeBinding" filter plugin for pod "example-blog-ghost-ccf6cb4c4-fc94s": pod has unbound immediate PersistentVolumeClaims
example   <unknown>   Normal    Scheduled                pod/example-blog-ghost-ccf6cb4c4-fc94s                Successfully assigned example/example-blog-ghost-ccf6cb4c4-fc94s to cluster-name
example   18m         Normal    SuccessfulAttachVolume   pod/example-blog-ghost-ccf6cb4c4-fc94s                AttachVolume.Attach succeeded for volume "pvc-b6cd4ca6-b410-4af2-ae2f-24b6169caa45"
example   18m         Normal    Pulled                   pod/example-blog-ghost-ccf6cb4c4-fc94s                Container image "docker.io/bitnami/ghost:3.33.0-debian-10-r6" already present on machine
example   18m         Normal    Created                  pod/example-blog-ghost-ccf6cb4c4-fc94s                Created container ghost
example   18m         Normal    Started                  pod/example-blog-ghost-ccf6cb4c4-fc94s                Started container ghost
example   3m35s       Warning   Unhealthy                pod/example-blog-ghost-ccf6cb4c4-fc94s                Readiness probe failed: Get http://10.244.0.37:2368/: dial tcp 10.244.0.37:2368: connect: connection refused
example   16m         Warning   Unhealthy                pod/example-blog-ghost-ccf6cb4c4-fc94s                Liveness probe failed: Get http://10.244.0.37:2368/: dial tcp 10.244.0.37:2368: connect: connection refused
example   19m         Normal    SuccessfulCreate         replicaset/example-blog-ghost-ccf6cb4c4               Created pod: example-blog-ghost-ccf6cb4c4-fc94s
example   23m         Normal    DeletingLoadBalancer     service/example-blog-ghost                            Deleting load balancer
example   23m         Normal    DeletedLoadBalancer      service/example-blog-ghost                            Deleted load balancer
example   19m         Normal    ExternalProvisioning     persistentvolumeclaim/example-blog-ghost              waiting for a volume to be created, either by external provisioner "provisioner-id" or manually created by system administrator
example   19m         Normal    Provisioning             persistentvolumeclaim/example-blog-ghost              External provisioner is provisioning volume for claim "example/example-blog-ghost"
example   16m         Normal    EnsuringLoadBalancer     service/example-blog-ghost                            Ensuring load balancer
example   19m         Normal    ScalingReplicaSet        deployment/example-blog-ghost                         Scaled up replica set example-blog-ghost-ccf6cb4c4 to 1
example   19m         Warning   BadConfig                ingress/example-blog-ghost                            Could not determine issuer for ingress due to bad annotations: failed to determine issuer name to be used for ingress resource
example   19m         Warning   SyncLoadBalancerFailed   service/example-blog-ghost                            Error syncing load balancer: failed to ensure load balancer: load-balancer is not yet active (current status: new)
example   19m         Warning   SyncLoadBalancerFailed   service/example-blog-ghost                            Error syncing load balancer: failed to ensure load balancer: failed to update load-balancer with ID id: PUT url-loadbalancer: 403 (request "id-1") Load Balancer can't be updated while it processes previous actions
example   19m         Normal    ProvisioningSucceeded    persistentvolumeclaim/example-blog-ghost              Successfully provisioned volume pvc-b6cd4ca6-b410-4af2-ae2f-24b6169caa45
example   18m         Warning   SyncLoadBalancerFailed   service/example-blog-ghost                            Error syncing load balancer: failed to ensure load balancer: failed to update load-balancer with ID id: PUT url-loadbalancer: 403 (request "id-2") Load Balancer can't be updated while it processes previous actions
example   18m         Warning   SyncLoadBalancerFailed   service/example-blog-ghost                            Error syncing load balancer: failed to ensure load balancer: failed to update load-balancer with ID id: PUT url-loadbalancer: 403 (request "id-3") Load Balancer can't be updated while it processes previous actions
example   17m         Warning   SyncLoadBalancerFailed   service/example-blog-ghost                            Error syncing load balancer: failed to ensure load balancer: failed to update load-balancer with ID id: PUT url-loadbalancer: 403 (request "id-4") Load Balancer can't be updated while it processes previous actions
example   16m         Normal    EnsuredLoadBalancer      service/example-blog-ghost                            Ensured load balancer
cert-manager    4m34s       Warning   Unhealthy                pod/cert-manager-webhook-567c5c769b-hxzzj                   Liveness probe failed: Get http://10.244.0.51:6080/livez: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
cert-manager    8m7s        Warning   Unhealthy                pod/cert-manager-webhook-567c5c769b-hxzzj                   Readiness probe failed: Get http://10.244.0.51:6080/healthz: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       73s         Warning   Unhealthy                pod/mariadb-master-0                                        Readiness probe failed: Get http://10.244.0.121:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       4m34s       Warning   Unhealthy                pod/mariadb-master-0                                        Liveness probe failed: Get http://10.244.0.121:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       4m41s       Warning   Unhealthy                pod/mariadb-slave-0                                         Readiness probe failed: Get http://10.244.0.92:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       4m33s       Warning   Unhealthy                pod/mariadb-slave-0                                         Liveness probe failed: Get http://10.244.0.92:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       4m40s       Warning   Unhealthy                pod/mariadb-slave-1                                         Liveness probe failed: Get http://10.244.0.72:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
databases       8m9s        Warning   Unhealthy                pod/mariadb-slave-1                                         Readiness probe failed: Get http://10.244.0.72:9104/metrics: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
default         22m         Warning   VolumeFailedDelete       persistentvolume/pvc-19869bc1-5a90-474e-a7e4-93c8a98fc47e   rpc error: code = Unknown desc = DELETE id: 409 (request "req1") failed to delete volume: attached volume cannot be deleted
default         22m         Warning   VolumeFailedDelete       persistentvolume/pvc-19869bc1-5a90-474e-a7e4-93c8a98fc47e   rpc error: code = Unknown desc = DELETE id: 409 (request "re2") failed to delete volume: attached volume cannot be deleted
default         22m         Warning   VolumeFailedDelete       persistentvolume/pvc-19869bc1-5a90-474e-a7e4-93c8a98fc47e   rpc error: code = Unknown desc = DELETE id: 409 (request "req3") failed to delete volume: attached volume cannot be deleted
kube-system     70s         Warning   Unhealthy                pod/cilium-operator-6d8c6cd8c4-98pdq                        Liveness probe failed: Get http://127.0.0.1:9234/healthz: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
routing         66s         Warning   Unhealthy                pod/traefik-7bfff8d8f6-wjlcc                                Readiness probe failed: Get http://10.244.0.40:9000/ping: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
routing         15m         Warning   Unhealthy                pod/traefik-7bfff8d8f6-wjlcc                                Liveness probe failed: Get http://10.244.0.40:9000/ping: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

kubectl get pods -n 示例

NAME                                       READY   STATUS    RESTARTS   AGE
example-blog-ghost-ccf6cb4c4-7p7v6    0/1     Running   1          5m21s

kubectl get ingress -A

NAMESPACE       NAME                       CLASS    HOSTS                            ADDRESS   PORTS     AGE
example   example-blog-ghost   <none>   blog.example.com             80, 443   6m13s

kubectl 记录 example-blog-ghost-ccf6cb4c4-7p7v6 -n example

Welcome to the Bitnami ghost container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-ghost
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-ghost/issues

nami    INFO  Initializing mysql-client
nami    INFO  mysql-client successfully initialized
nami    INFO  Initializing ghost
handler WARN  Using /opt/bitnami/ghost as working directory
mysql-c INFO  Trying to connect to MySQL server

我确保用户名和密码是正确的,我通过port-forward通过phpmyadmin登录,检查另一个chart是否可以访问mariadb数据库。我还确保创建了在幻影值文件中引用的数据库 table。

数据库:example_blog

我连接到 mariadb 的 phpmyadmin helm chart 值是:

port: 3306
host: mariadb

掌舵图来自这里:

https://hub.helm.sh/charts/bitnami/phpmyadmin

mariadb helm 图表来自这里:

https://hub.helm.sh/charts/bitnami/mariadb

另外,当我转到 https://blog.example.com(https 版本)时,我收到 404 页面未找到

在我的值文件中:

ghostProtocol: https
ghostHost: blog.example.com
ghostPort: 443
ghostPath: /

我的values.yml:

## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
# global:
#   imageRegistry: myRegistryName
#   imagePullSecrets:
#     - myRegistryKeySecretName
#   storageClass: myStorageClass

## Bitnami Ghost image version
## ref: https://hub.docker.com/r/bitnami/ghost/tags/
##
image:
  registry: docker.io
  repository: bitnami/ghost
  tag: 3.33.0-debian-10-r6
  ## Specify a imagePullPolicy
  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
  ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
  ##
  pullPolicy: IfNotPresent
  ## Optionally specify an array of imagePullSecrets.
  ## Secrets must be manually created in the namespace.
  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
  ##
  # pullSecrets:
  #   - myRegistryKeySecretName

## String to partially override ghost.fullname template (will maintain the release name)
##
# nameOverride:

## String to fully override ghost.fullname template
##
# fullnameOverride:

## Init containers parameters:
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
##
volumePermissions:
  image:
    registry: docker.io
    repository: bitnami/minideb
    tag: buster
    pullPolicy: Always
    ## Optionally specify an array of imagePullSecrets.
    ## Secrets must be manually created in the namespace.
    ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
    ##
    # pullSecrets:
    #   - myRegistryKeySecretName

## Ghost protocol, host, port and path to create application URLs
## ref: https://github.com/bitnami/bitnami-docker-ghost#configuration
##
ghostProtocol: https
ghostHost: blog.example.com
ghostPort: 443
ghostPath: /

## User of the application
## ref: https://github.com/bitnami/bitnami-docker-ghost#configuration
##
ghostUsername: example

## Application password
## Defaults to a random 10-character alphanumeric string if not set
## ref: https://github.com/bitnami/bitnami-docker-ghost#configuration
##
# ghostPassword:

## Admin email
## ref: https://github.com/bitnami/bitnami-docker-ghost#configuration
##
ghostEmail: example@example.com

## Ghost Blog name
## ref: https://github.com/bitnami/bitnami-docker-ghost#environment-variables
##
ghostBlogTitle: example

## Set to `true` to allow the container to be started with blank passwords
## ref: https://github.com/bitnami/bitnami-docker-wordpress#environment-variables
allowEmptyPassword: false

## SMTP mail delivery configuration
## ref: https://github.com/bitnami/bitnami-docker-redmine/#smtp-configuration
##
smtpHost: example
smtpPort: example
smtpUser: example
smtpPassword: ""
smtpFromAddress: "'example' <example@example.com>"
smtpService: example

## Use an existing secrets which already store your password data
##
# existingSecret:
#   ## Name of the existing secret
#   ##
#   name: mySecret
#   ## Key mapping where <key> is the value which the deployment is expecting and
#   ## <value> is the name of the key in the existing secret.
#   ##
#   keyMapping:
#     ghost-password: myGhostPasswordKey
#     smtp-password: mySmtpPasswordKey

## Configure extra options for liveness and readiness probes
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
##
livenessProbe:
  enabled: true
  initialDelaySeconds: 120
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 6
  successThreshold: 1
readinessProbe:
  enabled: true
  initialDelaySeconds: 30
  periodSeconds: 5
  timeoutSeconds: 3
  failureThreshold: 6
  successThreshold: 1

##
## External database configuration
##
externalDatabase:
  ## All of these values are only used when mariadb.enabled is set to false
  ## Database host
  host: mariadb

  ## non-root Username for Wordpress Database
  user: example

  ## Database password
  password: 

  ## Database name
  database: example_blog

  ## Database port number
  port: 3306

##
## MariaDB chart configuration
##
## https://github.com/bitnami/charts/blob/master/bitnami/mariadb/values.yaml
##
mariadb:
  ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters
  enabled: false
  ## Disable MariaDB replication
  replication:
    enabled: false

  ## Create a database and a database user
  ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
  ##
  db:
    name: bitnami_ghost
    user: bn_ghost
    ## If the password is not specified, mariadb will generates a random password
    ##
    # password:

  ## MariaDB admin password
  ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run
  ##
  # rootUser:
  #   password:

  ## Enable persistence using Persistent Volume Claims
  ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
  ##
  master:
    persistence:
      enabled: true
      ## mariadb data Persistent Volume Storage Class
      ## If defined, storageClassName: <storageClass>
      ## If set to "-", storageClassName: "", which disables dynamic provisioning
      ## If undefined (the default) or set to null, no storageClassName spec is
      ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
      ##   GKE, AWS & OpenStack)
      ##
      # storageClass: "-"
      accessMode: ReadWriteOnce
      size: 8Gi

## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer
##
service:
  type: LoadBalancer

  ## HTTP Port
  port: 80

  ## Extra ports to expose (normally used with the `sidecar` value)
  ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services
  ##
  extraPorts: []

  ## Specify the loadBalancerIP value for LoadBalancer service types.
  ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
  ##
  loadBalancerIP:

  ## nodePorts:
  ##   http: <to set explicitly, choose port between 30000-32767>
  nodePorts:
    http: ""

  ## Enable client source IP preservation
  ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
  ##
  externalTrafficPolicy: Cluster

  ## Service annotations. Evaluated as a template
  ##
  annotations: {}

## Pod Security Context
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
##
securityContext:
  enabled: true
  fsGroup: 1001
  runAsUser: 1001

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
  enabled: true
  ## ghost data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  # storageClass: "-"
  accessMode: ReadWriteOnce
  size: 8Gi
  path: /bitnami

## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
  requests:
    memory: 512Mi
    cpu: 300m

## Configure the ingress resource that allows you to access the
## Ghost installation. Set up the URL
## ref: http://kubernetes.io/docs/user-guide/ingress/
##
ingress:
  ## Set to true to enable ingress record generation
  enabled: true

  ## Set this to true in order to add the corresponding annotations for cert-manager
  certManager: true

  ## Ingress annotations. Evaluated as a template.
  ## For a full list of possible ingress annotations, please see
  ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
  ##
  ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
  ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
  annotations:
  #  kubernetes.io/ingress.class: nginx
     kubernetes.io/ingress.class: traefik

  ## The list of hostnames to be covered with this ingress record.
  ## Most likely this will be just one host, but in the event more hosts are needed, this is an array
  hosts:
    - name: blog.example.com
      path: /

      ## Set this to true in order to enable TLS on the ingress record
      tls: true

      ## Optionally specify the TLS hosts for the ingress record
      ## Useful when the Ingress controller supports www-redirection
      ## If not specified, the above host name will be used
      # tlsHosts:
      # - www.ghost.local
      # - ghost.local

      ## If TLS is set to true, you must declare what secret will store the key/certificate for TLS
      tlsSecret: example-ghost.local-tls

  secrets:
  ## If you're providing your own certificates, please use this to add the certificates as secrets
  ## key and certificate should start with -----BEGIN CERTIFICATE----- or
  ## -----BEGIN RSA PRIVATE KEY-----
  ##
  ## name should line up with a tlsSecret set further up
  ## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set
  ##
  ## It is also possible to create and manage the certificates outside of this helm chart
  ## Please see README.md for more information
  # - name: ghost.local-tls
  #   key:
  #   certificate:

## Node selector for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
##
nodeSelector: {}

## Affinity for pod assignment (evaluated as a template)
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

## Additional pod annotations
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
##
podAnnotations: {}

## Add sidecars to the pod
## For example:
## sidecars:
##   - name: your-image-name
##     image: your-image
##     imagePullPolicy: Always
##     ports:
##       - name: portname
##         containerPort: 1234
sidecars: []

## Add init containers to the pod
## For example:
## initContainers:
##   - name: your-image-name
##     image: your-image
##     imagePullPolicy: Always
##
initContainers: []

## Array to add extra volumes
##
extraVolumes: []

## Array to add extra mounts (normally used with extraVolumes)
##
extraVolumeMounts: []

## An array to add extra env vars
## For example:
## extraEnvVars:
##  - name: MY_ENV_VAR
##    value: env_var_value
##
extraEnvVars: []

## Name of a ConfigMap containing extra env vars
##
extraEnvVarsConfigMap:

## Name of a Secret containing extra env vars
##
extraEnvVarsSecret:

所以我有点不确定接下来要尝试什么?有什么想法吗?

当您在另一个命名空间中时,请务必将以下内容放入 helm 值文件中:

host: mariadb.databases