Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
modules
.gitignore
1-provider.tf
2-kube-controller.tf
3-kube-node-pool.tf
Makefile
README.md
controller.tpl
output.tf
terraform.tfvars.sample
vars.tf

README.md

Kubernetes on DigitalOcean

This is a Terraform project for deploying Kubernetes on DigitalOcean with node pools management capability.

This project configures your cluster with:

  • The DigitalOcean Cloud Controller Manager (for Load Balancers and Volume support)
  • Secrets Encryption (Optional)
  • Stores Terraform State in DigitalOcean Spaces (see Makefile for Spaces initialization)

Requirements

The only required variables are digitalocean_token, count, and ssh_key_fingerprints. Review vars.tf for full listing of available options.

Node Pool Management

To instantiate a new node pool after initial spinup, in 3-kube-node.tf1, define a pool using the node pool module like this:

module "node_pool_green" {
  source = "modules/node_pool"

  kube_token         = "${module.kube_token_1.token}"
  kubernetes_version = "${var.kubernetes_version}"
  pool_label         = "green"
  count          = "${var.count}"
  size           = "${var.primary_size}"
  region           = "${var.region}"
  cluster_name       = "${var.cluster_name}"
  controller_address = "${digitalocean_droplet.k8s_primary.ipv4_address}"
  ssh_key_fingerprints = "${var.ssh_key_fingerprints}"
}

where the label is green (rather than the initial pool, blue) and then, generate a new kube_token (ensure the module name matches the kube_token field in the spec above, i.e. kube_token_2) by defining this in 1-provider.tf (or anywhere before the node_pool instantiation):

module "kube_token_2" {
  source = "modules/kube-token"
}

Generate your new token:

terraform apply -target=module.kube_token_2

On your controller, add your new token, and then apply the new node pool:

terraform apply -target=module.node_pool_green

At which point, you can either destroy the old pool, or taint/evict pods, etc. once this new pool connects.

You can’t perform that action at this time.