Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

Kubernetes Guestbook written in HCL

The Kubernetes guestbook application, written in HCL

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-hcl-guestbook
cd pulumi-examples/kubernetes-hcl-guestbook

A version of the Kubernetes Guestbook application, written in Pulumi HCL. It deploys a Redis leader, Redis replicas, and a PHP frontend exposed through a LoadBalancer service. Pulumi installs the HCL language plugin and the Terraform Kubernetes provider automatically the first time you run the program.

Prerequisites#

  1. Install Pulumi
  2. Configure Kubernetes

Deploying the example#

  1. Make sure ~/.kube/config points at a running Kubernetes cluster. The frontend service has type LoadBalancer, so the cluster must be able to provision one — on minikube, enable the MetalLB addon.

  2. Create a new stack:

    Terminal window
    pulumi stack init guestbook-testing
  3. Deploy the stack:

    Terminal window
    pulumi up
  4. Open the frontend IP in a browser to use the guestbook:

    Terminal window
    pulumi stack output frontend_ip

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.