首页 > 解决方案 > 在 kubernates 上部署 bitnami/wordpress 的问题

问题描述

欢迎,

我试图在 kubernetes 上安装 Wordpress。我安装了图表并输入:“helm install projectname-wordpress bitnami/wordpress --set allowOverrideNone=true”

但即使它给出输出它也不起作用,我无法登录。

当我输入“kubectl describe pods”时

我得到这样的输出:

Name:           projectname-wordpress-785d4c4c84-xzt6m
Namespace:      default
Priority:       0
Node:           skalowalne-node-73a107/59.813.226.646
Start Time:     Fri, 28 May 2021 02:00:35 +0200
Labels:         app.kubernetes.io/instance=projectname-wordpress
                app.kubernetes.io/managed-by=Helm
                app.kubernetes.io/name=wordpress
                helm.sh/chart=wordpress-11.0.10
                pod-template-hash=785d4c4c84
Annotations:    <none>
Status:         Pending
IP:
IPs:            <none>
Controlled By:  ReplicaSet/projectname-wordpress-785d4c4c84
Containers:
  wordpress:
    Container ID:
    Image:          docker.io/bitnami/wordpress:5.7.2-debian-10-r9
    Image ID:
    Ports:          8080/TCP, 8443/TCP
    Host Ports:     0/TCP, 0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Requests:
      cpu:      300m
      memory:   512Mi
    Liveness:   http-get http://:http/wp-admin/install.php delay=120s timeout=5s period=10s #success=1 #failure=6
    Readiness:  http-get http://:http/wp-login.php delay=30s timeout=5s period=10s #success=1 #failure=6
    Environment:
      ALLOW_EMPTY_PASSWORD:                   yes
      MARIADB_HOST:                           projectname-wordpress-mariadb
      MARIADB_PORT_NUMBER:                    3306
      WORDPRESS_DATABASE_NAME:                bitnami_wordpress
      WORDPRESS_DATABASE_USER:                bn_wordpress
      WORDPRESS_DATABASE_PASSWORD:            <set to the key 'mariadb-password' in secret 'projectname-wordpress-mariadb'>  Optional: false
      WORDPRESS_USERNAME:                     user
      WORDPRESS_PASSWORD:                     <set to the key 'wordpress-password' in secret 'projectname-wordpress'>  Optional: false
      WORDPRESS_EMAIL:                        user@example.com
      WORDPRESS_FIRST_NAME:                   FirstName
      WORDPRESS_LAST_NAME:                    LastName
      WORDPRESS_HTACCESS_OVERRIDE_NONE:       no
      WORDPRESS_ENABLE_HTACCESS_PERSISTENCE:  no
      WORDPRESS_BLOG_NAME:                    User's Blog!
      WORDPRESS_SKIP_BOOTSTRAP:               no
      WORDPRESS_TABLE_PREFIX:                 wp_
      WORDPRESS_SCHEME:                       http
      WORDPRESS_EXTRA_WP_CONFIG_CONTENT:
      WORDPRESS_AUTO_UPDATE_LEVEL:            none
      WORDPRESS_PLUGINS:                      none
    Mounts:
      /bitnami/wordpress from wordpress-data (rw,path="wordpress")
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-mxtw7 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  wordpress-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  projectname-wordpress
    ReadOnly:   false
  default-token-mxtw7:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-mxtw7
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason              Age                   From                     Message
  ----     ------              ----                  ----                     -------
  Warning  FailedMount         15m (x181 over 9h)    kubelet                  Unable to attach or mount volumes: unmounted volumes=[wordpress-data], unattached volumes=[wordpress-data default-token-mxtw7]: timed out waiting for the condition
  Warning  FailedMount         3m49s (x58 over 8h)   kubelet                  Unable to attach or mount volumes: unmounted volumes=[wordpress-data], unattached volumes=[default-token-mxtw7 wordpress-data]: timed out waiting for the condition
  Warning  FailedAttachVolume  2m40s (x139 over 9h)  attachdetach-controller  AttachVolume.Attach failed for volume "ovh-managed-kubernetes-do2ymc-pvc-80079ec2-e6f9-4210-852e-04fa286f714c" : attachdetachment timeout for volume 3b160677-40e8-4170-9cc3-cdd58e230942


Name:           projectname-wordpress-mariadb-0
Namespace:      default
Priority:       0
Node:           skalowalne-node-f1da93/59.83.226.180
Start Time:     Fri, 28 May 2021 02:00:27 +0200
Labels:         app.kubernetes.io/component=primary
                app.kubernetes.io/instance=projectname-wordpress
                app.kubernetes.io/managed-by=Helm
                app.kubernetes.io/name=mariadb
                controller-revision-hash=projectname-wordpress-mariadb-85d4cb8f7
                helm.sh/chart=mariadb-9.3.11
                statefulset.kubernetes.io/pod-name=projectname-wordpress-mariadb-0
Annotations:    checksum/configuration: 878384c0d68b5abc46d5d5d719a9e83aa911941710552c3dfcebd48203ce5d9f
Status:         Pending
IP:
IPs:            <none>
Controlled By:  StatefulSet/projectname-wordpress-mariadb
Containers:
  mariadb:
    Container ID:
    Image:          docker.io/bitnami/mariadb:10.5.10-debian-10-r0
    Image ID:
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Liveness:       exec [/bin/bash -ec password_aux="${MARIADB_ROOT_PASSWORD:-}"
if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:  exec [/bin/bash -ec password_aux="${MARIADB_ROOT_PASSWORD:-}"
if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
    password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
fi
mysqladmin status -uroot -p"${password_aux}"
] delay=30s timeout=1s period=10s #success=1 #failure=3
    Environment:
      BITNAMI_DEBUG:          false
      MARIADB_ROOT_PASSWORD:  <set to the key 'mariadb-root-password' in secret 'projectname-wordpress-mariadb'>  Optional: false
      MARIADB_USER:           bn_wordpress
      MARIADB_PASSWORD:       <set to the key 'mariadb-password' in secret 'projectname-wordpress-mariadb'>  Optional: false
      MARIADB_DATABASE:       bitnami_wordpress
    Mounts:
      /bitnami/mariadb from data (rw)
      /opt/bitnami/mariadb/conf/my.cnf from config (rw,path="my.cnf")
      /var/run/secrets/kubernetes.io/serviceaccount from projectname-wordpress-mariadb-token-92mm2 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  data-projectname-wordpress-mariadb-0
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      projectname-wordpress-mariadb
    Optional:  false
  projectname-wordpress-mariadb-token-92mm2:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  projectname-wordpress-mariadb-token-92mm2
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason              Age                   From                     Message
  ----     ------              ----                  ----                     -------
  Warning  FailedMount         19m (x41 over 8h)     kubelet                  Unable to attach or mount volumes: unmounted volumes=[data], unattached volumes=[config projectname-wordpress-mariadb-token-92mm2 data]: timed out waiting for the condition
  Warning  FailedMount         9m51s (x36 over 8h)   kubelet                  Unable to attach or mount volumes: unmounted volumes=[data], unattached volumes=[projectname-wordpress-mariadb-token-92mm2 data config]: timed out waiting for the condition
  Warning  FailedMount         5m21s (x161 over 9h)  kubelet                  Unable to attach or mount volumes: unmounted volumes=[data], unattached volumes=[data config projectname-wordpress-mariadb-token-92mm2]: timed out waiting for the condition
  Warning  FailedAttachVolume  2m48s (x139 over 9h)  attachdetach-controller  AttachVolume.Attach failed for volume "ovh-managed-kubernetes-do2ymc-pvc-fad9b535-f6d5-4e71-9e47-3a555936c546" : attachdetachment timeout for volume d96dbb2d-2200-48bd-940d-74dc0c3b5128

更新:我没有在云机器上启用防火墙。我正在使用 ovh 服务。

我应该怎么做才能让它工作?

在尝试部署 wordpress 之后,失败的事件看起来就像这样:

    Events:
  Type     Reason              Age                  From                     Message
  ----     ------              ----                 ----                     -------
  Warning  FailedScheduling    5m19s                default-scheduler        0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims.
  Warning  FailedScheduling    5m19s                default-scheduler        0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims.
  Normal   Scheduled           5m12s                default-scheduler        Successfully assigned default/projectname-wordpress-5466b7b45c-rzx9h to standard-node-fe7236
  Warning  FailedMount         3m10s                kubelet                  Unable to attach or mount volumes: unmounted volumes=[wordpress-data], unattached volumes=[default-token-mxtw7 wordpress-data]: timed out waiting for the condition
  Warning  FailedAttachVolume  72s (x2 over 3m13s)  attachdetach-controller  AttachVolume.Attach failed for volume "ovh-managed-kubernetes-do2ymc-pvc-3e3686eb-6cf5-4697-99b0-0689bbd7d0a9" : attachdetachment timeout for volume f8b78a8d-f0d8-4dcb-bcae-ec84fb7d82e4
  Warning  FailedMount         56s                  kubelet                  Unable to attach or mount volumes: unmounted volumes=[wordpress-data], unattached volumes=[wordpress-data default-token-mxtw7]: timed out waiting for the condition

来自第一个 pod 的日志

mariadb 16:49:02.01 mariadb 16:49:02.01 欢迎使用 Bitnami mariadb 容器 mariadb 16:49:02.01 通过观看https://github.com/bitnami/bitnami-docker-mariadb mariadb 16:49订阅项目更新 : 02.02 在https://github.com/bitnami/bitnami-docker-mariadb/issues提交问题和功能请求 mariadb 16:49:02.02 在 containers@bitnami.com 向我们发送您的反馈 mariadb 16:49:02.02 mariadb 16:49 :02.02 INFO ==> ** 开始 MariaDB 设置 ** mariadb 16:49:02.07 INFO ==> 验证 MYSQL_ /MARIADB_中的设置 env vars mariadb 16:49:02.07 INFO ==> 初始化 mariadb 数据库 mariadb 16:49:02.09 INFO ==> 使用持久数据 mariadb 16:49:02.10 INFO ==> 运行 mysql_upgrade mariadb 16:49:02.10 INFO ==>在后台启动 mariadb mariadb 16:49:03.14 INFO ==> 停止 mariadb

来自第二个 pod 的日志

欢迎使用 Bitnami wordpress 容器 通过观看https://github.com/bitnami/bitnami-docker-wordpress订阅项目更新 在 https://github.com/bitnami/bitnami-docker-wordpress/issues提交问题和功能请求 通过 container@bitnami.com 向我们发送您的反馈

WARN ==> 您设置了环境变量 ALLOW_EMPTY_PASSWORD=yes。出于安全原因,请勿在生产环境中使用此标志。nami INFO 初始化 apache nami INFO apache 成功初始化 nami INFO 初始化 php nami INFO php 成功初始化 nami INFO 初始化 mysql-client nami INFO mysql-client 成功初始化 nami INFO 初始化 wordpress wordpre INFO ==> 准备 Varnish 环境 wordpre INFO ==> 准备 Apache environment wordpre INFO ==> Preparing PHP environment mysql-c INFO Trying to connect to MySQL server Error execution 'postInstallation': Failed to connect to cryptostudent-mariadb:3306 after 36 try

标签: wordpresskuberneteschartscloudbitnami

解决方案


我重置了 kubernates 并且相同的代码开始工作。我让一切都一样,所以我不知道怎么做。谢谢大家的支持。


推荐阅读