Skip to content

Creating Terraform Templates on OpenStack


This advanced tutorial will guide you through setting up a Terraform project and deploying virtual machines (VMs) with Docker & lightweight Kubernetes (Rancher K3s).


Understand how to install software and provision multiple VMs

Understand how Terraform is used to orchestrate VMs together

Ability to create a Terraform deployment for a multi-node JupyterHub

Ability to re-provisioning an already deployed cluster on OpenStack through Terraform

Things we won't cover

Basic management of Kubernetes clusters (that is a different lesson)

All of Terraform's features



By the end of this tutorial, you will

have launched a lightweight Kubernetes (K3s) cluster

know how to modify the size of cluster to scale up and down with more or less resources

started and stopped a JupyterHub using a public Docker image

Updating Terraform Configurations

We will re-use our configurations from the Terraform basics lesson

We will update and append the following files: - we are going to be adding new variables to include specific features related to our K3s and JupyterHub - we are going to be launching multiple VM flavors to support our cluster. We want the server VM to be large enough to manage all of the JupyterHub worker nodes. - we need to specify all of the new security and networking settings for K3s and JupyterHub

We will create new configuration files for: - we will keep our Kubernetes (Rancher) configuration files here - we will specify the JupyterHub Docker image here - we will configure our JupyterHub here

Our new cluster is going to be variably sized, meaning we can re-size or re-scale the number of VMs running in our cluster to account for demand by our users.

We are going to be using the featured Datascience Latest image from the Project Jupyter team

Start the Deployment

Re-sizing the VMs while the Deployment is running

Adding / Removing VMs from the cluster while it is running

Managing the K3s configuration

Restarting the JupyterHub

Last update: 2023-03-27