หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Easily Switch Between Product Types

You can click the drop-down list box to switch between different product types.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Deploying WordPress Using Helm

Updated on 2024-09-29 GMT+08:00

Helm is a package manager that streamlines the deployment, upgrade, and management of Kubernetes applications. Helm uses charts (a packaging format that defines Kubernetes resources) to encapsulate all elements deployed by Kubernetes, including application code, dependencies, configuration files, and deployment instructions. With Helm, you can easily deploy and manage complex Kubernetes applications, simplifying application development and deployment.

This section describes how to deploy a WordPress workload using Helm.

Prerequisites

You have created a CCE cluster that contains at least one node with 4 vCPUs and 8 GiB memory. The node is bound with an EIP for pulling the WordPress images from an external repository. For details on how to create a cluster, see Creating a Kubernetes Cluster.

Preparations

  1. Download and configure kubectl to access the cluster.

    Log in to the CCE console and click the target cluster name to access the cluster console. In the Connection Information area of the Overview page, click Configure next to kubectl and configure kubectl as instructed.

    Figure 1 kubectl
  2. Install Helm 3.

Deploying WordPress

  1. Add the official WordPress repository.

    helm repo add bitnami https://charts.bitnami.com/bitnami

  2. Run the following commands to create a WordPress workload:

    helm install myblog bitnami/wordpress \
        --set mariadb.primary.persistence.enabled=true \
        --set mariadb.primary.persistence.storageClass=csi-disk \
        --set mariadb.primary.persistence.size=10Gi \
        --set persistence.enabled=false
    NOTE:
    • MariaDB uses persistent volumes (PVs) to store data. The PV is automatically created with an EVS disk of 10 GiB by configuring StorageClassName.
    • Data persistence is not required for WordPress. Set persistence.enabled to false for the data volume.

    Information similar to the following is displayed:

    coalesce.go:223: warning: destination for mariadb.networkPolicy.egressRules.customRules is a table. Ignoring non-table value ([])
    NAME: myblog
    LAST DEPLOYED: Mon Mar 27 11:47:58 2023
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    NOTES:
    CHART NAME: wordpress
    CHART VERSION: 15.2.57
    APP VERSION: 6.1.1
    
    ** Be patient while the chart is being deployed.**
    
    Your WordPress site can be accessed through the following DNS name from within your cluster:
    
        myblog-wordpress.default.svc.cluster.local (port 80)
    
    To access your WordPress site from outside the cluster, follow the steps below:
    
    1. Get the WordPress URL by running these commands:
    
      NOTE: It may take a few minutes for the LoadBalancer IP to be available.
            Watch the status with: 'kubectl get svc --namespace default -w myblog-wordpress'
    
       export SERVICE_IP=$(kubectl get svc --namespace default myblog-wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
       echo "WordPress URL: http://$SERVICE_IP/"
       echo "WordPress Admin URL: http://$SERVICE_IP/admin"
    
    2. Open a browser and access WordPress using the obtained URL.
    
    3. Log in with the following credentials below to see your blog:
    
      echo Username: user
      echo Password: $(kubectl get secret --namespace default myblog-wordpress -o jsonpath="{.data.wordpress-password}" | base64 -d)

    The command output shows how to obtain the WordPress URL and the username and password for accessing the WordPress backend.

Accessing WordPress

  1. Modify the WordPress Service configuration.

    Additional annotation configuration is required for using a LoadBalancer Service in CCE. However, bitnami/wordpress does not have this configuration. You need to manually modify the configuration.

    kubectl edit svc myblog-wordpress

    Add kubernetes.io/elb.autocreate and kubernetes.io/elb.class to metadata.annotations and save the modification. The two annotations are used to create a shared load balancer so that the WordPress workload can be accessed through the EIP of the load balancer.

    apiVersion: v1
    kind: Service
    metadata:
      name: myblog-wordpress
      namespace: default
      annotations:
        kubernetes.io/elb.autocreate: '{ "type": "public", "bandwidth_name": "myblog-wordpress", "bandwidth_chargemode": "bandwidth", "bandwidth_size": 5, "bandwidth_sharetype": "PER", "eip_type": "5_bgp" }'
        kubernetes.io/elb.class: union
    spec:
      ports:
        - name: http
    ...

  2. Obtain the public network load balancer IP address of Service myblog-wordpress and access it.

    On the Services tab, locate myblog-wordpress and find its public network load balancer IP address.

    In the address box of a browser, enter <Public IP address of the load balancer>:80 to access WordPress.

    In the address box of a browser, enter <EIP of the load balancer>:80/login to access the WordPress backend as user. Run the following command to obtain the password of user:

    kubectl get secret --namespace default myblog-wordpress -o jsonpath="{.data.wordpress-password}" | base64 -d

Deleting the WordPress Workload

  1. Run the following command to delete the WordPress workload:

    helm delete myblog

    Information similar to the following is displayed:
    release "myblog" uninstalled

  2. Delete the PersistentVolumeClaim (PVC) used by the mariadb component in WordPress.

    kubectl delete pvc data-myblog-mariadb-0

    Information similar to the following is displayed:
    persistentvolumeclaim "data-myblog-mariadb-0" deleted

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback