ram-devsecops / terraform-rancher

Some Terraform resources to install a Rancher control plane K8s cluster via RKE and custom K8s clusters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Install Terraform on your local workstation (version >= 0.13): https://www.terraform.io/downloads.html

  2. Copy the template terraform "tfvars" file (terraform.tfvars.tmpl) to terraform.tfvars and adjust the values according to your environment. Further configuration values can be seen inside variables.tf and then also be overridden inside terraform.tfvars.

cp terraform.tfvars.tmpl terraform.tfvars
  1. Initialize Terraform:
terraform init

Getting Started

  1. Test the Terraform changes by running terraform plan
terraform plan
  1. If the Terraform plan output looks good start with the cluster creation:
terraform apply
  1. Configure your kubectl to use the generated kube_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

About

Some Terraform resources to install a Rancher control plane K8s cluster via RKE and custom K8s clusters

License:GNU General Public License v3.0


Languages

Language:HCL 100.0%