Skip to content

Commit

Permalink
Add Kubernetes Helm Wordpress example
Browse files Browse the repository at this point in the history
  • Loading branch information
hausdorff committed Aug 17, 2018
1 parent 55ad876 commit 6387a25
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kubernetes-ts-helm-wordpress/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: wordpress
description: A minimal installation of the latest version of the Wordpress Helm chart
runtime: nodejs
93 changes: 93 additions & 0 deletions kubernetes-ts-helm-wordpress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Kubernetes: Deploying the Wordpress Helm chart

Uses the Helm API of `@pulumi/kubernetes` to deploy `v2.1.3` of the Wordpress Helm Chart to a
Kubernetes cluster. **The Tiller server is not required to be installed.** Pulumi will expand the
Helm Chart and submit the expanded YAML to the cluster.

> **NOTE:** Because Tiller is not used, it is important to be aware that a small number of Charts
> depend on values that can only be expanded on the server. These variables will get default values
> instead.
> **NOTE:** This example has a dependency on the `helm` CLI. **Be sure to install that first!** See
> instructions below.
![wordpress](images/deploy.gif "Wordpress Helm Chart deployment")

## Running the App

Use the [Helm installation guide](https://docs.helm.sh/using_helm/#installing-helm) to install the
`helm` CLI. On macOS this might look something like:

```sh
brew install kubernetes-helm
```

Once `helm` is installed, initialize it with:

```sh
helm init --client-only
```

If you haven't already, follow the steps in [Pulumi Installation and
Setup](https://docs.pulumi.com/install/) and [Configuring Pulumi
Kubernetes](https://docs.pulumi.com/reference/kubernetes.html#configuration) to get setup with
Pulumi and Kubernetes.

Now, install dependencies:

```sh
npm install
```

Create a new stack:

```sh
$ pulumi stack init
Enter a stack name: wordpress-dev
```

Preview the deployment of the application.

> **TIP:** This example installs the Wordpress Chart. You can use `helm search` to find other Helm
> charts, as well as available versions for them.
Perform the deployment:

```sh
$ pulumi up
Updating stack 'wordpress-dev'
Performing changes:

Type Name Status Info
+ pulumi:pulumi:Stack wordpress-wordpress-dev created 1 warning
+ └─ kubernetes:helm.sh:Chart wpdev created
+ ├─ kubernetes:core:ConfigMap wpdev-mariadb created
+ ├─ kubernetes:core:ConfigMap wpdev-mariadb-tests created
+ ├─ kubernetes:core:Secret wpdev-mariadb created
+ ├─ kubernetes:core:Secret wpdev-wordpress created
+ ├─ kubernetes:core:Service wpdev-wordpress created 1 warning, 2 info messages
+ ├─ kubernetes:core:Service wpdev-mariadb created 1 warning, 1 info message
+ ├─ kubernetes:core:Pod wpdev-credentials-test created 17 warnings
+ ├─ kubernetes:core:Pod wpdev-mariadb-test-mgjjy created 32 warnings
+ ├─ kubernetes:core:PersistentVolumeClaim wpdev-wordpress created
+ ├─ kubernetes:apps:StatefulSet wpdev-mariadb created
+ └─ kubernetes:extensions:Deployment wpdev-wordpress created

---outputs:---
frontendIp: "35.193.210.254"

info: 13 changes performed:
+ 13 resources created
Update duration: 1m28.601219022s

Permalink: https://app.pulumi.com/hausdorff/wordpress-dev/updates/1
```

We can see here in the `---outputs:---` section that Wordpress was allocated a public IP, in this
case `35.193.210.254`. It is exported with a stack output variable, `frontendIp`. We can use `curl`
and `grep` to retrieve the `<title>` of the site the proxy points at.

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

0 comments on commit 6387a25

Please sign in to comment.