Skip to content

Terraform module to install Rancher on an existing Kubernetes cluster

License

Notifications You must be signed in to change notification settings

terraform-rancher-modules/terraform-rancher-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform | Rancher Install

Terraform module to install Rancher using helm to complete an HA installation.

Usage

Reference the module in a terraform file.

For example, rancher.tf:

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"
}
terraform init
terraform apply

Examples

Private CA and certificates

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"

  tls_source   = "secret"
  cacerts_path = "certs/ca.pem"
  tls_crt_path = "certs/cert.pem"
  tls_key_path = "certs/key.pem"
}

Custom kubeconfig location

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"
  kubeconfig_file  = "/path/to/kubeconfig"
}

Single replica for Rancher, and pin the version

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"
  rancher_replicas  = 1
  rancher_version   = "2.6.2"
}

Additional values for the Rancher chart

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"
  rancher_additional_helm_values = [
    "bootstrapPassword: secret-string",
    "auditLog.level: 1"
  ]
}

Air-gap environment (without auth)

module "rancher_install" {
  source = "github.com/terraform-rancher-modules/terraform-rancher-install"

  rancher_hostname = "rancher.example.com"

  airgap = true
  default_registry = "registry.example.com:5000"
  helm_repository = "https://helm.example.com/rancher-charts/"
}

Requirements

Name Version
helm >= 2.4.1
kubernetes >= 2.6.1

Providers

Name Version
helm 2.4.1
kubernetes 2.6.1

Modules

No modules.

Resources

Name Type
helm_release.cert_manager resource
helm_release.rancher resource
kubernetes_secret.image_pull_secret resource
kubernetes_secret.tls_ca resource
kubernetes_secret.tls_rancher_ingress resource

Inputs

Name Description Type Default Required
airgap Enable airgap options for the Rancher environment, requires default_registry to be set bool false no
cacerts_path Private CA certificate to use for Rancher UI/API connectivity string null no
cert_manager_enable Install cert-manager even if not needed for Rancher, useful if migrating to certificates string false no
cert_manager_namespace Namesapce to install cert-manager string "cert-manager" no
cert_manager_version Version of cert-manager to install string "v1.5.1" no
default_registry Default container image registry to pull images in the format of registry.domain.com:port (systemDefaultRegistry helm value) string null no
helm_password Private helm repository password string null no
helm_repository Helm repository for Rancher and cert-manager charts string null no
helm_username Private helm repository username string null no
kubeconfig_file The kubeconfig to use to interact with the cluster string "~/.kube/config" no
rancher_additional_helm_values Helm options to provide to the Rancher helm chart list(string) [] no
rancher_antiaffinity Value for antiAffinity when installing the Rancher helm chart (required/preferred) string "required" no
rancher_bootstrap_password Password to use for bootstrapping Rancher string "admin" no
rancher_hostname Value for hostname when installing the Rancher helm chart string n/a yes
rancher_replicas Value for replicas when installing the Rancher helm chart number 3 no
rancher_version Rancher version to install string null no
registry_password Private container image registry password string null no
registry_username Private container image registry username string null no
tls_crt_path TLS certificate to use for Rancher UI/API connectivity string null no
tls_key_path TLS key to use for Rancher UI/API connectivity string null no
tls_source Value for ingress.tls.source when installing the Rancher helm chart string "rancher" no

Outputs

Name Description
rancher_bootstrap_password Password to use for bootstrapping Rancher
rancher_hostname Value for hostname when installing the Rancher helm chart

About

Terraform module to install Rancher on an existing Kubernetes cluster

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages