Skip to main content

WordPress Helm chart

A minimal Go Pulumi program

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set kubernetes-go-helm-wordpress
cd pulumi-examples/kubernetes-go-helm-wordpress

Uses the Helm API of pulumi-kubernetes to deploy v9.6.0 of the WordPress Helm chart to a Kubernetes cluster. Pulumi will expand the Helm chart and submit the expanded YAML to the cluster.

Prerequisites#

  1. Install Pulumi
  2. Configure Kubernetes
  3. Install Go

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init wordpress-dev
  2. Install dependencies:

    Terminal window
    go mod download
  3. Deploy the stack:

    Terminal window
    pulumi up
    Updating (wordpress-dev)
    View Live: https://app.pulumi.com/.../updates/7
    Type Name Status
    + pulumi:pulumi:Stack kubernetes-go-helm-wordpress-wordpress-dev created
    + └─ kubernetes:helm.sh:Chart wpdev created
    + ├─ kubernetes:core:Secret default/wpdev-mariadb created
    + ├─ kubernetes:core:Secret wpdev-wordpress created
    + ├─ kubernetes:core:PersistentVolumeClaim wpdev-wordpress created
    + ├─ kubernetes:core:Service wpdev-wordpress created
    + ├─ kubernetes:core:ConfigMap default/wpdev-mariadb created
    + ├─ kubernetes:core:Service default/wpdev-mariadb created
    + ├─ kubernetes:apps:StatefulSet default/wpdev-mariadb created
    + └─ kubernetes:apps:Deployment wpdev-wordpress created
    Outputs:
    frontendIp: "35.193.210.254"
    Resources:
    + 10 created
    Duration: 53s
  4. WordPress was allocated a public IP, in this case 35.193.210.254, exported as the stack output frontendIp. Use curl and grep to retrieve the <title> of the site:

    Terminal window
    curl -sL $(pulumi stack output frontendIp):80 | grep "<title>"
    <title>User&#039;s Blog! &#8211; Just another WordPress site</title>

    You can also navigate to the site in a web browser.

Cleaning up#

Once you’re finished experimenting, you can destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.