bitnami/wordpress-nginx:最新通过Terraform, bug产生(空白页,混合内容)



名称和版本最新bitnami这样/wordpress-nginx:

您使用的是什么架构?amd64

哪些步骤会重现bug?我有一个AWS EKS集群,正在通过bitnami安装wordpress nginx,这个系统使用MySQL和EFS文件系统。

一切似乎都如预期的那样工作。但是当第一次访问Wordpress URL时,我看到以下内容:

几分钟后空白屏幕(然后是没有CSS的内容)。我注意到日志显示错误

注意:docker在ingress-nginx后面,允许加密证书代码:

# WORDPRESS Deployment
resource "kubernetes_deployment_v1" "this" {
metadata {
name      = "${var.deployment_prefix}-wp-${terraform.workspace}"
namespace = var.customers_namespace
labels    = {
app = "${var.deployment_prefix}-wp-${terraform.workspace}"
}
}
spec {
replicas = 3
selector {
match_labels = {
app = "${var.deployment_prefix}-wp-${terraform.workspace}"
}
}
template {
metadata {
labels = {
app = "${var.deployment_prefix}-wp-${terraform.workspace}"
}
}
spec {
volume {
name = "${var.deployment_prefix}-wp-content"
persistent_volume_claim {
claim_name = kubernetes_persistent_volume_claim.this.metadata.0.name
}
}
volume {
name = "${var.deployment_prefix}-nginx-configs-${terraform.workspace}"
config_map {
name = "${var.deployment_prefix}-nginx-configs-${terraform.workspace}"
}
}
container {
security_context {
run_as_non_root = true
run_as_user     = 1001
}
name  = "${var.deployment_prefix}-wp-${terraform.workspace}"
image = "bitnami/wordpress-nginx:6.1.1"
volume_mount {
name       = "${var.deployment_prefix}-wp-content"
mount_path = "/bitnami/wordpress"
}
volume_mount {
mount_path = "/opt/bitnami/nginx/conf/server_blocks/nginx.conf:ro"
name       = "${var.deployment_prefix}-nginx-configs-${terraform.workspace}"
}
port {
container_port = var.service_port
}
env {
name  = "WORDPRESS_DATABASE_HOST"
value = kubernetes_service_v1.mysql_svc.metadata.0.name
}
env {
name  = "WORDPRESS_DATABASE_NAME"
value = "wordpress"
}
env {
name  = "WORDPRESS_DATABASE_USER"
value = "yafa"
}
env {
name = "WORDPRESS_DATABASE_PASSWORD"
value_from {
secret_key_ref {
name = kubernetes_secret_v1.this.metadata.0.name
key  = "password"
}
}
}
env {
name  = "NGINX_HTTP_PORT_NUMBER"
value = var.service_port
}
env {
name  = "BITNAMI_DEBUG"
value = "true"
}
env {
name  = "WORDPRESS_USERNAME"
value = "yafa"
}
env {
name  = "WORDPRESS_PASSWORD"
value = var.mysql_pass
}
env {
name  = "BITNAMI_DEBUG"
value = "true"
}
env {
name  = "WORDPRESS_BLOG_NAME"
value = var.deployment_prefix
}
env {
name  = "FORCE_SSL_LOGIN"
value = "true"
}
env {
name  = "FORCE_SSL_ADMIN"
value = "ture"
}
env {
name  = "CONCATENATE_SCRIPTS"
value = "false"
}
env {
name  = "SCRIPT_DEBUG"
value = "true"
}
env {
name  = "WORDPRESS_DATA_TO_PERSIST"
value = "wp-config.php wp-content"
}
env {
name  = "WORDPRESS_ENABLE_HTACCESS_PERSISTENCE"
value = "yes"
}
env {
name  = "NGINX_ENABLE_ABSOLUTE_REDIRECT"
value = "yes"
}
env {
name  = "NGINX_ENABLE_PORT_IN_REDIRECT"
value = "yes"
}
# PHP
env {
name  = "PHP_MAX_EXECUTION_TIME"
value = "300"
}
env {
name  = "BITNAMI_DEBUG"
value = true
}
env {
name  = "PHP_MAX_INPUT_VARS"
value = "3000"
}
env {
name  = "PHP_UPLOAD_MAX_FILESIZE"
value = "250m"
}
/*
- WORDPRESS_SMTP_HOST=smtp.gmail.com
- WORDPRESS_SMTP_PORT=587
- WORDPRESS_SMTP_USER=your_email@gmail.com
- WORDPRESS_SMTP_PASSWORD=your_password
*/
}
}
}
}
depends_on = [
kubernetes_persistent_volume_claim.this, kubernetes_deployment_v1.mysql
]
wait_for_rollout = false
}
resource "kubectl_manifest" "nginx_configmap" {
yaml_body = <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: "${var.deployment_prefix}-nginx-configs-${terraform.workspace}"
namespace: ${var.customers_namespace}
labels:
app: "${var.deployment_prefix}-nginx-configs-${terraform.workspace}"
data:
nginx.conf: |-
server {
listen 0.0.0.0:${var.service_port};
server_name ${var.domain};
root /;
index index.php index.htm index.html;
}
EOF
}

论述在这里输入图像描述输入图片描述

我累了不同的图像,但无法完成这个

我使用下面的代码解决了这个问题,通过改变用户并给它一个标志为privileged = true

# WORDPRESS DEPLOYMENT
resource "kubernetes_deployment_v1" "this" {
metadata {
name      = "wordpress-${var.deployment_prefix}-${terraform.workspace}"
namespace = var.customers_namespace
labels    = {
app = "wordpress-${var.deployment_prefix}-${terraform.workspace}"
}
}
spec {
replicas = 3
selector {
match_labels = {
app = "wordpress-${var.deployment_prefix}-${terraform.workspace}"
}
}
template {
metadata {
labels = {
app = "wordpress-${var.deployment_prefix}-${terraform.workspace}"
}
}
spec {
container {
security_context {
privileged      = true
run_as_non_root = true
run_as_user     = 1001
}
image = "bitnami/wordpress"
name  = "${var.deployment_prefix}-wordpress-${terraform.workspace}"
env {
name  = "WORDPRESS_DATABASE_HOST"
value = kubernetes_service_v1.mysql_svc.metadata.0.name
}
env {
name  = "WORDPRESS_DATABASE_USER"
value = "yafa"
}
env {
name = "WORDPRESS_DATABASE_PASSWORD"
value_from {
secret_key_ref {
key  = "password"
name = kubernetes_secret_v1.this.metadata.0.name
}
}
}
env {
name  = "WORDPRESS_RESET_DATA_PERMISSIONS"
value = "yes"
}
env {
name  = "WORDPRESS_BLOG_NAME"
value = var.deployment_prefix
}
env {
name  = "WORDPRESS_EMAIL"
value = "info@${var.domain}"
}
env {
name  = "WORDPRESS_USERNAME"
value = "yafa"
}
env {
name  = "WORDPRESS_PASSWORD"
value = var.mysql_pass
}
env {
name  = "WORDPRESS_ENABLE_HTACCESS_PERSISTENCE"
value = "yes"
}
env {
name  = "WORDPRESS_HTACCESS_OVERRIDE_NONE"
value = "yes"
}
env {
name  = "WORDPRESS_DATABASE_NAME"
value = "wordpress"
}
env {
name  = "WORDPRESS_DATA_TO_PERSIST"
value = "wp-config.php wp-content"
}
env {
name  = "WORDPRESS_ENABLE_HTACCESS_PERSISTENCE"
value = "yes"
}
env {
name  = "PHP_MAX_EXECUTION_TIME"
value = "300"
}
env {
name  = "PHP_MAX_INPUT_VARS"
value = "3000"
}
env {
name  = "PHP_UPLOAD_MAX_FILESIZE"
value = "250m"
}
volume_mount {
name       = kubernetes_persistent_volume_claim.this.metadata.0.name
mount_path = "/bitnami"
}
port {
container_port = 8080
}
}
volume {
name = kubernetes_persistent_volume_claim.this.metadata.0.name
persistent_volume_claim {
claim_name = kubernetes_persistent_volume_claim.this.metadata.0.name
}
}
}
}
}
wait_for_rollout = false
}

相关内容

  • 没有找到相关文章

最新更新