[K8S集群初始化系列] WordPress 快速安装

By | 31 7 月, 2023

前置环境

K8S v1.27.3,单节点 control plane,三节点 worker。

已经按照 https://doraemonext.com/archives/385.html 完成了 MySQL 的安装。

安装 WordPress

helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/wordpress --version 16.1.34
tar zvxf wordpress-16.1.34.tgz

修改 wordpress/values.yaml 中的内容:

  • wordpressUsername (自行更改)
  • wordpressPassword (自行更改)
  • wordpressEmail (自行更改)
  • wordpressFirstName (自行更改)
  • wordpressLastName (自行更改)
  • wordpressSchema: https
  • mariadb.enable: false
  • externalDatabase.host (自行更改)
  • externalDatabase.user (自行更改)
  • externalDatabase.password (自行更改)
  • externalDatabase.database (自行更改)
  • externalDatabase.port (自行更改)
  • wordpressConfigureCache: true
  • memcached.enabled: true
  • replicaCount: 3
  • persistence.accessModes: ReadWriteMany (多副本一定要 ReadWriteMany,这里需要 cephfs 支持)
  • persistence.size: 20Gi

然后安装:

helm install wordpress wordpress

等待 Pod 到终态。

配置 Istio Ingress

从上到下分别是证书申请,Istio 网关配置,Istio 虚拟服务配置。

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: doraemonext-com-cert-prod
  namespace: istio-system
spec:
  dnsNames:
  - doraemonext.com
  - www.doraemonext.com
  duration: 2160h0m0s
  issuerRef:
    group: cert-manager.io
    kind: ClusterIssuer
    name: letsencrypt
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: 2048
  renewBefore: 360h0m0s
  secretName: doraemonext-com-cert-prod
  usages:
  - server auth
  - client auth
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: blog-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "doraemonext.com"
    - "www.doraemonext.com"
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: doraemonext-com-cert-prod
    hosts:
    - "doraemonext.com"
    - "www.doraemonext.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: blog-vs
  namespace: istio-system
spec:
  hosts:
  - "doraemonext.com"
  - "www.doraemonext.com"
  gateways:
  - blog-gateway
  http:
  - match:
    - port: 80
    redirect:
      authority: "doraemonext.com:443"
      scheme: https
  - match:
    - port: 443
    route:
    - destination:
        host: wordpress.default.svc.cluster.local
        port:
          number: 80

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注