Skip to content

Latest commit

 

History

History
118 lines (84 loc) · 3.63 KB

README.md

File metadata and controls

118 lines (84 loc) · 3.63 KB

terraform-provider-rke

Go Report Card Build Status

Terraform RKE providers can easily deploy Kubernetes clusters with Rancher Kubernetes Engine.

Compatible Versions

  • Terraform: v0.11+
  • RKE: v0.1.7 (Kubernetes 1.8, 1.9 and 1.10)

Installation

Usage

Target Node Requirements

It is same as the requirements of RKE

Requirements of RKE

  • Docker versions 1.11.2 up to 1.13.1 and 17.03.x are validated for Kubernetes versions 1.8, 1.9 and 1.10
  • OpenSSH 7.0+ must be installed on each node for stream local forwarding to work.
  • The SSH user used for node access must be a member of the docker group:
  • Ports 6443, 2379, and 2380 should be opened between cluster nodes.
  • Swap disabled on worker nodes.

Examples

Minimal example

resource rke_cluster "cluster" {
  nodes = [
    {
      address = "1.2.3.4"
      user    = "rancher"
      role    = ["controlplane", "worker", "etcd"]
      ssh_key = "${file("~/.ssh/id_rsa")}"
    },
  ]
}

###############################################################################
# If you need kubeconfig.yml for using kubectl, please uncomment follows.
###############################################################################
//resource "local_file" "kube_cluster_yaml" {
//  filename = "${path.root}/kube_config_cluster.yml"
//  content = "${rke_cluster.cluster.kube_config_yaml}"
//}
  • default k8s version: v1.10.1-rancher1
  • default network plugin: canal

With cloud provider

With Kubernetes provider

You can view an example of using RKE provider and Kubernetes provider together, here.

resource rke_cluster "cluster" {
  nodes = [
    {
      address = "1.2.3.4"
      user    = "ubuntu"
      role    = ["controlplane", "worker", "etcd"]
      ssh_key = "${file("~/.ssh/id_rsa")}"
    },
  ]
}

provider "kubernetes" {
  host     = "${rke_cluster.cluster.api_server_url}"
  username = "${rke_cluster.cluster.kube_admin_user}"

  client_certificate     = "${rke_cluster.cluster.client_cert}"
  client_key             = "${rke_cluster.cluster.client_key}"
  cluster_ca_certificate = "${rke_cluster.cluster.ca_crt}"
  # load_config_file = false
}

resource "kubernetes_namespace" "example" {
  metadata {
    name = "terraform-example-namespace"
  }
}

Deploying Rancher 2.0 using terraform-provider-rke

You can view examples to deploying Rancher 2.0

Full example

You can view full example of tffile, here.

License

terraform-provider-rke Copyright (C) 2018 Kazumichi Yamamoto.

This project is published under Apache 2.0 License.

Author