Terraform Resources for Rancher K8s Clusters
Disclaimer!: We use this as a base for our own and customer setup at puzzle. Heavy work in progress and a lot of things that can be improved. Feel free to contribute. We are happy to assist.
These Terraform resource definitions can be used to:
- Deploy a RKE based Rancher Control Plane K8s cluster
- Add a custom K8s cluster to an existing Rancher Control Plane
- Install some infrastructure related Apps like (Nginx ingress controller, Cert-Manager, etc.)
Prerequisites
Installation- / Jump-Host
-
Install Terraform on your local workstation (version >= 0.13): https://www.terraform.io/downloads.html
-
Copy the template terraform "tfvars" file (
terraform.tfvars.tmpl
) toterraform.tfvars
and adjust the values according to your environment. Further configuration values can be seen insidevariables.tf
and then also be overridden insideterraform.tfvars
.
cp terraform.tfvars.tmpl terraform.tfvars
- Initialize Terraform:
terraform init
Getting Started
- Test the Terraform changes by running
terraform plan
terraform plan
- If the Terraform plan output looks good start with the cluster creation:
terraform apply
- Configure your
kubectl
to use the generatedkube_config_cluster.yml
from the RKE K8s cluster:
$ export KUBECONFIG=$(pwd)/kube_config_cluster.yml
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
172.20.20.10.xip.puzzle.ch Ready controlplane,etcd,worker 3m29s v1.18.6
License
GPLv3
Author Information
- Philip Schmid