This repository contains:
- An example on how to set up rancher server in an HA configuration using terraform.
- How to provision a cluster for workloads and attach that to rancher using terraform
- How to manage a provisioned cluster using rancher and terraform
- How to deploy applications into the cluster using terraform
This example uses the terraform RKE provider - https://github.com/yamamoto-febc/terraform-provider-rke. To use this, you need to follow the installation instructions.
Note - currently this project is using a fork of the RKE provider, found here: https://github.com/drpebcak/terraform-provider-rke/tree/backup-folder. This fork will be removed once this PR is merged and released: rancher/terraform-provider-rke#123
- Go into the
rancher-server
directory
- This directory contains terraform that uses RKE to set up a kubernetes cluster, configures helm, installs cert-manager, and then installs rancher.
- Run terraform
terraform init
terraform apply
- You will probably want to modify some of the locals for your environment
- Go into the
user-cluster
directory
- This directory contains terraform that uses the rancher2 provider to create a custom cluster that is managed by rancher.
- Run terraform
terraform init
terraform apply
- You will probably want to modify some of the locals for your environment
- Go to the
install-app
directory
- This directory contains terraform that uses the rancher2 provider to add a custom catalog and install a helm chart.
- Run terraform
terraform init
terraform apply
If you don't work at rancher, you will probably need to modify some of this configuration. The aws
provider assumes you want to use a specific profile
for access to AWS. Feel free to modify this in rancher-server
and user-cluster
. We also sort of assume that you want a domain name for rancher-server
based on ${local.name}.${local.domain}
- you should probably change those as well. Finally, we are assuming that you use Route53 for your DNS. In rancher-server/infra.tf
we make a DNS record for your rancher server. If you do not use Route53, you should change this to reference whatever DNS provider you would like to use instead.