1. Release Notes
    1. Release Notes - 2.0.2Latest
    1. Release Notes - 2.0.1
    1. Release Notes - 2.0.0
  1. Introduction
    1. Introduction
    1. Features
    1. Architecture
    1. Advantages
    1. Glossary
  1. Installation
    1. Intruction
      1. Intro
      2. Port Requirements
    1. Install on Linux
      1. All-in-One Installation
      2. Multi-Node Installation
      3. Installing HA Master and Etcd Cluster
      4. Storage Configuration Instruction
    1. Install on Kubernetes
      1. Prerequisites
      2. Online Installation
      3. Offline Installation
    1. Related Tools
      1. Integrating Harbor Registry
    1. Cluster Operation
      1. Adding New Nodes
      2. High Risk Operation
      3. Uninstalling KubeSphere
  1. Quick Start
    1. Getting Started with Multitenancy
    1. Exposing your APP using Ingress
    1. Deploying a MySQL Application
    1. Deploying a Wordpress Website
    1. Job to compute π to 2000 places
    1. Deploying Grafana using APP Template
    1. Creating Horizontal Pod Autoscaler
    1. S2i: Publish your app without Dockerfile
    1. Canary Release of Microservice APP
    1. CI/CD based on Spring Boot Project
    1. Building a Pipeline in a Graphical Panel
    1. CI/CD based on GitLab and Harbor
    1. Ingress-Nginx for Grayscale Release
  1. Cluster Admin Guide
    1. Multi-tenant Management
      1. Overview of Multi-tenant Management
      2. Overview of Role Management
    1. Platform Management
      1. Account Management
      2. Platform Roles Management
    1. Infrastructure
      1. Service Components
      2. Nodes
      3. Storage Classes
    1. Monitoring Center
      1. Physical Resources
      2. Application Resources
    1. Application Repository
    1. Jenkins System Settings
  1. User Guide
    1. Application Template
    1. Workloads
      1. Deployments
      2. StatefulSets
      3. DaemonSets
      4. Jobs
      5. CronJobs
    1. Storage
      1. Volumes
    1. Network & Services
      1. Services
      2. Routes
    1. Configuration Center
      1. Secret
      2. ConfigMap
      3. Image Registry
    1. Project Settings
      1. Basic Information
      2. Member Roles
      3. Project Members
      4. Internet Access
    1. DevOps Project
      1. DevOps Project Management
      2. DevOps Project Management
      3. DevOps Project Management
      4. DevOps Project Management
      5. DevOps Project Management
  1. Development Guide
    1. Preparing the Development Environment
    1. Development Workflow
  1. API Documentation
    1. API Guide
    1. How to invoke KubeSphere API
KubeSphere®️ 2020 All Rights Reserved.

Deploying a WordPress Web Application


In this tutorial we will create a Deployment as an example, demonstrating how to deploy Wordpress web application to KubeSphere, which is based on the last tutorial Deploy a MySQL StatefulSet. The password between WordPress and MySQL will be created and saved as a ConfigMap.


  • You need to create a MySQL StatefulSet, see the Tutorial 3 if not yet.
  • You need to sign in with project-regular and enter into the corresponding project.

Estimated Time

About 15 minutes.

Hands-on Lab

Step 1: Create a ConfigMap

The environment variable WORDPRESS_DB_PASSWORD is the password to connect the database in Wordpress. In this presentation, create a ConfigMap to replace the environment variable. A ConfigMap will be written as an environment variable when create Wordpress container group setting.

1.1. Login KubeSphere as project-regular. Enter demo-project, navigate to Configuration Center → ConfigMaps, then click Create ConfigMap.

1.2. Fill in the basic information, e.g. Name : wordpress-configmap, then click Next

1.3. ConfigMap parameter is composed of a set of key-value pairs, fill in the blanks with the following values and click Create button when you've done.

  • value: 123456

Step 2: Create a Volume

2.1. Navigate to Volumes, and click Create. Then fill in the basic information, e.g. Name : wordpress-pvc, click Next when you've done.

2.2. Leave the default values in Volume Settings, click Next and choose Create. You will be able to see the volume wordpress-pvc has been created successfully.

Reminder: The volume will display Pending if it is not yet mounted, actually it's normal since local volume doesn't suppor Dynamic Volume Provisioning. It will change to Bound when it has been mounted to the workload.

Step 3: Create a Deployment

3.1. Navigate to Workloads → Deployments, then click Create button.

3.2. Fill in the basic information, e.g. Name : wordpress, then choose Next.

3.3. Click Add Container, then fill in the table according to the following hints.

  • Image: wordpress:4.8-apache

  • Container Name: wordpress

  • Service Settings:

    • Name: port
    • Protocol: TCP
    • Port: 80

3.4. Check the box for Environmental Variable, and fill in the blanks with follow values:

  • Environmental Variables (It requires to create 2 environmental variables in this section)

    • Click Reference Config Center
    • Fill in the name with WORDPRESS_DB_PASSWORD
    • Select resource: select wordpress-configmap
    • Click Add Environmental Variable
    • Value: mysql-service

3.5. Other blanks could be remained default values, choose Save → Next when you've done.

3.6. Choose Add Existing Volume, select the wordpress-pvc which was created in Step 2.

3.7. Select ReadAndWrite and set the Mount Path to /var/www/html. Then click Save → Next → Create when you've done. Now we've created the Wordpress Deployment succeessfully.

Step 4: Create a Service

4.1. Navigate to Network & ServiceService, then click Create button.

4.2. Fill in the basic information, e.g. Name : wordpress-service, click Next and reference the following list to complete the Service Settings:

  • Service Type: choose the first item Virtual IP: Access the service through the internal IP of the cluster

  • Selector: Click Specify Workload, then select wordpress and click Save.

  • Ports:

    • Name: port
    • Protocol: TCP
    • Port: 80
    • Target port: 80

4.3. Click Next → Next to skip the Label Settings. We are going to expose this service via NodePort, so choose NodePort and click Create, the wordpress-service has been created successfully. We got the NodePort 30204 from the Service list.

Step 5: Access the WordPress Application

At this point, WordPress is exposed to the outside by the Service, thus we can access this application in your browser via {$Node IP}:{$NodePort}, for example since we selected http protocol previously.