-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for worker pools on google-cloud
* Set defaults for internal worker module's count, machine_type, and os_image * Allow "pools" of homogeneous workers to be created using the google-cloud/kubernetes/workers module
- Loading branch information
Showing
6 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Advanced | ||
|
||
Typhoon clusters offer several advanced features for skilled users. | ||
|
||
* [Customization](customization.md) | ||
* [Worker Pools](worker-pools.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Worker Pools | ||
|
||
Typhoon on Google Cloud can create "worker pools", groups of homogeneous workers that are part of an existing cluster. For example, you may wish to augment a Kubernetes cluster with groups of workers with a different machine type, larger disks, or preemptibility. | ||
|
||
Create a cluster following the Google Cloud [tutorial](../google-cloud.md#cluster). | ||
|
||
``` | ||
module "google-cloud-yavin" { | ||
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes?ref=v1.9.4" | ||
providers = { | ||
google = "google.default" | ||
local = "local.default" | ||
null = "null.default" | ||
template = "template.default" | ||
tls = "tls.default" | ||
} | ||
# Google Cloud | ||
region = "us-central1" | ||
dns_zone = "example.com" | ||
dns_zone_name = "example-zone" | ||
os_image = "coreos-stable" | ||
cluster_name = "yavin" | ||
controller_count = 1 | ||
worker_count = 2 | ||
ssh_authorized_key = "ssh-rsa AAAAB3Nz..." | ||
# output assets dir | ||
asset_dir = "/home/user/.secrets/clusters/yavin" | ||
} | ||
``` | ||
|
||
Create a worker pool using the internal `workers` Terraform module. | ||
|
||
``` | ||
module "yavin-worker-pool" { | ||
source = "git::https://github.com/poseidon/typhoon//google-cloud/container-linux/kubernetes/workers?ref=v1.9.4" | ||
# Google Cloud | ||
network = "${module.google-cloud-yavin.network_name}" | ||
region = "us-central1" | ||
count = 2 | ||
machine_type = "n1-standard-16" | ||
os_image = "coreos-stable" | ||
preemptible = true | ||
cluster_name = "yavin-16x" | ||
ssh_authorized_key = "${var.ssh_authorized_key}" | ||
kubeconfig = "${module.google-cloud-yavin.kubeconfig}" | ||
} | ||
``` | ||
|
||
Apply the change. | ||
|
||
``` | ||
terraform apply | ||
``` | ||
|
||
Verify a managed instance group of workers joins the cluster within a few minutes. | ||
|
||
``` | ||
$ export KUBECONFIG=/home/user/.secrets/clusters/yavin/auth/kubeconfig | ||
$ kubectl get nodes | ||
NAME STATUS AGE VERSION | ||
yavin-controller-0.c.example-com.internal Ready 6m v1.9.3 | ||
yavin-worker-jrbf.c.example-com.internal Ready 5m v1.9.3 | ||
yavin-worker-mzdm.c.example-com.internal Ready 5m v1.9.3 | ||
yavin-16x-worker-jrbf.c.example-com.internal Ready 3m v1.9.3 | ||
yavin-16x-worker-mzdm.c.example-com.internal Ready 3m v1.9.3 | ||
``` | ||
|
||
### Variables | ||
|
||
The Google Cloud internal `workers` module supports a number of [variables](https://github.com/poseidon/typhoon/blob/master/google-cloud/container-linux/kubernetes/workers/variables.tf). | ||
|
||
#### Required | ||
|
||
| Name | Description | Example | | ||
|:-----|:------------|:--------| | ||
| cluster_name | Unique name | "yavin-worker-pool" | | ||
| region | Must match region of cluster | "us-central1" | | ||
| network | Must match network name output by cluster | "${module.cluster.network_name}" | | ||
| ssh_authorized_key | SSH public key for ~/.ssh_authorized_keys | "ssh-rsa AAAAB3NZ..." | | ||
|
||
#### Optional | ||
|
||
| Name | Description | Default | Example | | ||
|:-----|:------------|:--------|:--------| | ||
| count | Number of workers | 1 | 3 | | ||
| machine_type | Machine type for compute instances | "n1-standard-1" | See below | | ||
| os_image | OS image for compute instances | "coreos-stable" | | ||
| disk_size | Size of the disk in GB | 40 | | ||
| preemptible | If enabled, Compute Engine will terminate instances randomly within 24 hours | false | true | | ||
| service_cidr | Must match service_cidr of cluster | "10.3.0.0/16" | "10.3.0.0/24" | | ||
| cluster_domain_suffix | Must match domain suffix of cluster | "cluster.local" | "k8s.example.com" | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters