2018-02-26 23:06:18 +01:00
# Worker Pools
2018-08-28 07:24:52 +02:00
Typhoon AWS, Azure, and Google Cloud allow additional groups of workers to be defined and joined to a cluster. For example, add worker pools of instances with different types, disk sizes, Container Linux channels, or preemptibility modes.
2018-02-27 07:16:34 +01:00
Internal Terraform Modules:
2020-10-21 07:47:19 +02:00
* `aws/flatcar-linux/kubernetes/workers`
2020-04-11 23:52:30 +02:00
* `aws/fedora-coreos/kubernetes/workers`
2020-10-21 07:47:19 +02:00
* `azure/flatcar-linux/kubernetes/workers`
2020-04-13 00:49:48 +02:00
* `azure/fedora-coreos/kubernetes/workers`
2020-10-21 07:47:19 +02:00
* `google-cloud/flatcar-linux/kubernetes/workers`
2020-04-11 23:52:30 +02:00
* `google-cloud/fedora-coreos/kubernetes/workers`
2018-02-27 07:16:34 +01:00
## AWS
2020-05-21 07:53:51 +02:00
Create a cluster following the AWS [tutorial ](../flatcar-linux/aws.md#cluster ). Define a worker pool using the AWS internal `workers` module.
2018-02-27 07:16:34 +01:00
2020-08-28 09:25:12 +02:00
=== "Fedora CoreOS"
```tf
module "tempest-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//aws/fedora-coreos/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# AWS
vpc_id = module.tempest.vpc_id
subnet_ids = module.tempest.subnet_ids
security_groups = module.tempest.worker_security_groups
# configuration
name = "tempest-pool"
kubeconfig = module.tempest.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
instance_type = "m5.large"
os_stream = "next"
}
```
=== "Flatcar Linux"
```tf
module "tempest-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//aws/flatcar-linux/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# AWS
vpc_id = module.tempest.vpc_id
subnet_ids = module.tempest.subnet_ids
security_groups = module.tempest.worker_security_groups
# configuration
name = "tempest-pool"
kubeconfig = module.tempest.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
instance_type = "m5.large"
os_image = "flatcar-beta"
}
```
2018-02-27 07:16:34 +01:00
Apply the change.
```
terraform apply
```
2018-08-28 07:24:52 +02:00
Verify an auto-scaling group of workers joins the cluster within a few minutes.
2018-02-27 07:16:34 +01:00
### Variables
2020-10-21 07:47:19 +02:00
The AWS internal `workers` module supports a number of [variables ](https://github.com/poseidon/typhoon/blob/master/aws/flatcar-linux/kubernetes/workers/variables.tf ).
2018-02-27 07:16:34 +01:00
#### Required
| Name | Description | Example |
|:-----|:------------|:--------|
2018-08-28 07:24:52 +02:00
| name | Unique name (distinct from cluster name) | "tempest-m5s" |
2019-05-28 05:42:48 +02:00
| vpc_id | Must be set to `vpc_id` output by cluster | module.cluster.vpc_id |
| subnet_ids | Must be set to `subnet_ids` output by cluster | module.cluster.subnet_ids |
| security_groups | Must be set to `worker_security_groups` output by cluster | module.cluster.worker_security_groups |
| kubeconfig | Must be set to `kubeconfig` output by cluster | module.cluster.kubeconfig |
2018-03-26 06:36:10 +02:00
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
2018-02-27 07:16:34 +01:00
#### Optional
| Name | Description | Default | Example |
|:-----|:------------|:--------|:--------|
2019-05-28 01:33:21 +02:00
| worker_count | Number of instances | 1 | 3 |
2019-01-12 09:07:48 +01:00
| instance_type | EC2 instance type | "t3.small" | "t3.medium" |
2021-02-21 00:36:52 +01:00
| os_image | AMI channel for a Container Linux derivative | "flatcar-stable" | flatcar-stable, flatcar-beta, flatcar-alpha |
2020-06-30 10:30:18 +02:00
| os_stream | Fedora CoreOS stream for compute instances | "stable" | "testing", "next" |
2019-09-29 20:14:36 +02:00
| disk_size | Size of the EBS volume in GB | 40 | 100 |
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
| disk_iops | IOPS of the EBS volume | 0 (i.e. auto) | 400 |
| spot_price | Spot price in USD for worker instances or 0 to use on-demand instances | 0 | 0.10 |
2020-08-28 09:25:12 +02:00
| snippets | Fedora CoreOS or Container Linux Config snippets | [] | [examples ](/advanced/customization/ ) |
2018-02-27 07:16:34 +01:00
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
2019-09-29 00:01:14 +02:00
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
2018-02-27 07:16:34 +01:00
2018-04-29 22:19:00 +02:00
Check the list of valid [instance types ](https://aws.amazon.com/ec2/instance-types/ ) or per-region and per-type [spot prices ](https://aws.amazon.com/ec2/spot/pricing/ ).
2018-02-26 23:06:18 +01:00
2018-08-28 07:24:52 +02:00
## Azure
2020-05-21 07:53:51 +02:00
Create a cluster following the Azure [tutorial ](../flatcar-linux/azure.md#cluster ). Define a worker pool using the Azure internal `workers` module.
2018-08-28 07:24:52 +02:00
2020-08-28 09:25:12 +02:00
=== "Fedora CoreOS"
```tf
module "ramius-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//azure/fedora-coreos/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# Azure
region = module.ramius.region
resource_group_name = module.ramius.resource_group_name
subnet_id = module.ramius.subnet_id
security_group_id = module.ramius.security_group_id
backend_address_pool_id = module.ramius.backend_address_pool_id
# configuration
name = "ramius-spot"
kubeconfig = module.ramius.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
vm_type = "Standard_F4"
priority = "Spot"
os_image = "/subscriptions/some/path/Microsoft.Compute/images/fedora-coreos-31.20200323.3.2"
}
```
=== "Flatcar Linux"
```tf
module "ramius-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//azure/flatcar-linux/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# Azure
region = module.ramius.region
resource_group_name = module.ramius.resource_group_name
subnet_id = module.ramius.subnet_id
security_group_id = module.ramius.security_group_id
backend_address_pool_id = module.ramius.backend_address_pool_id
# configuration
name = "ramius-spot"
kubeconfig = module.ramius.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
vm_type = "Standard_F4"
priority = "Spot"
os_image = "flatcar-beta"
}
```
2018-08-28 07:24:52 +02:00
Apply the change.
```
terraform apply
```
Verify a scale set of workers joins the cluster within a few minutes.
### Variables
2020-10-21 07:47:19 +02:00
The Azure internal `workers` module supports a number of [variables ](https://github.com/poseidon/typhoon/blob/master/azure/flatcar-linux/kubernetes/workers/variables.tf ).
2018-08-28 07:24:52 +02:00
#### Required
| Name | Description | Example |
|:-----|:------------|:--------|
| name | Unique name (distinct from cluster name) | "ramius-f4" |
2019-05-28 06:43:08 +02:00
| region | Must be set to `region` output by cluster | module.cluster.region |
| resource_group_name | Must be set to `resource_group_name` output by cluster | module.cluster.resource_group_name |
| subnet_id | Must be set to `subnet_id` output by cluster | module.cluster.subnet_id |
| security_group_id | Must be set to `security_group_id` output by cluster | module.cluster.security_group_id |
| backend_address_pool_id | Must be set to `backend_address_pool_id` output by cluster | module.cluster.backend_address_pool_id |
| kubeconfig | Must be set to `kubeconfig` output by cluster | module.cluster.kubeconfig |
2018-08-28 07:24:52 +02:00
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
#### Optional
| Name | Description | Default | Example |
|:-----|:------------|:--------|:--------|
2019-05-28 01:33:21 +02:00
| worker_count | Number of instances | 1 | 3 |
2019-10-01 07:18:15 +02:00
| vm_type | Machine type for instances | "Standard_DS1_v2" | See below |
2021-02-21 00:36:52 +01:00
| os_image | Channel for a Container Linux derivative | "flatcar-stable" | flatcar-stable, flatcar-beta, flatcar-alpha |
2020-04-11 23:52:30 +02:00
| priority | Set priority to Spot to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | "Regular" | "Spot" |
| snippets | Container Linux Config snippets | [] | [examples ](/advanced/customization/ ) |
2018-08-28 07:24:52 +02:00
| service_cidr | CIDR IPv4 range to assign to Kubernetes services | "10.3.0.0/16" | "10.3.0.0/24" |
2019-09-29 00:01:14 +02:00
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
2018-08-28 07:24:52 +02:00
Check the list of valid [machine types ](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/ ) and their [specs ](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes-general ). Use `az vm list-skus` to get the identifier.
2018-02-26 23:06:18 +01:00
## Google Cloud
2020-05-21 07:53:51 +02:00
Create a cluster following the Google Cloud [tutorial ](../flatcar-linux/google-cloud.md#cluster ). Define a worker pool using the Google Cloud internal `workers` module.
2018-02-26 23:06:18 +01:00
2020-08-28 09:25:12 +02:00
=== "Fedora CoreOS"
```tf
module "yavin-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//google-cloud/fedora-coreos/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# Google Cloud
region = "europe-west2"
network = module.yavin.network_name
cluster_name = "yavin"
# configuration
name = "yavin-16x"
kubeconfig = module.yavin.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
machine_type = "n1-standard-16"
os_stream = "testing"
preemptible = true
}
```
=== "Flatcar Linux"
```tf
module "yavin-worker-pool" {
2021-03-19 19:27:31 +01:00
source = "git::https://github.com/poseidon/typhoon//google-cloud/flatcar-linux/kubernetes/workers?ref=v1.20.5"
2020-08-28 09:25:12 +02:00
# Google Cloud
region = "europe-west2"
network = module.yavin.network_name
cluster_name = "yavin"
# configuration
name = "yavin-16x"
kubeconfig = module.yavin.kubeconfig
ssh_authorized_key = var.ssh_authorized_key
# optional
worker_count = 2
machine_type = "n1-standard-16"
os_image = "flatcar-linux-2303-4-0" # custom
preemptible = true
}
```
2018-02-26 23:06:18 +01:00
Apply the change.
```
terraform apply
```
Verify a managed instance group of workers joins the cluster within a few minutes.
```
$ kubectl get nodes
NAME STATUS AGE VERSION
2021-03-19 19:27:31 +01:00
yavin-controller-0.c.example-com.internal Ready 6m v1.20.5
yavin-worker-jrbf.c.example-com.internal Ready 5m v1.20.5
yavin-worker-mzdm.c.example-com.internal Ready 5m v1.20.5
yavin-16x-worker-jrbf.c.example-com.internal Ready 3m v1.20.5
yavin-16x-worker-mzdm.c.example-com.internal Ready 3m v1.20.5
2018-02-26 23:06:18 +01:00
```
### Variables
2020-10-21 07:47:19 +02:00
The Google Cloud internal `workers` module supports a number of [variables ](https://github.com/poseidon/typhoon/blob/master/google-cloud/flatcar-linux/kubernetes/workers/variables.tf ).
2018-02-26 23:06:18 +01:00
#### Required
| Name | Description | Example |
|:-----|:------------|:--------|
2018-03-04 01:21:38 +01:00
| name | Unique name (distinct from cluster name) | "yavin-16x" |
2019-10-01 07:04:35 +02:00
| cluster_name | Must be set to `cluster_name` of cluster | "yavin" |
2018-08-28 07:24:52 +02:00
| region | Region for the worker pool instances. May differ from the cluster's region | "europe-west2" |
2019-05-28 06:14:25 +02:00
| network | Must be set to `network_name` output by cluster | module.cluster.network_name |
| kubeconfig | Must be set to `kubeconfig` output by cluster | module.cluster.kubeconfig |
2020-06-30 10:30:18 +02:00
| os_image | Container Linux image for compute instances | "uploaded-flatcar-image" |
2018-03-26 06:36:10 +02:00
| ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." |
2018-02-26 23:06:18 +01:00
2018-08-28 07:24:52 +02:00
Check the list of regions [docs ](https://cloud.google.com/compute/docs/regions-zones/regions-zones ) or with `gcloud compute regions list` .
2018-02-26 23:06:18 +01:00
#### Optional
| Name | Description | Default | Example |
|:-----|:------------|:--------|:--------|
2019-05-28 01:33:21 +02:00
| worker_count | Number of instances | 1 | 3 |
2018-02-27 07:16:34 +01:00
| machine_type | Compute instance machine type | "n1-standard-1" | See below |
2020-05-08 10:18:34 +02:00
| os_stream | Fedora CoreOS stream for compute instances | "stable" | "testing", "next" |
2018-02-26 23:06:18 +01:00
| disk_size | Size of the disk in GB | 40 | 100 |
2018-02-27 07:16:34 +01:00
| preemptible | If true, Compute Engine will terminate instances randomly within 24 hours | false | true |
2020-04-11 23:52:30 +02:00
| snippets | Container Linux Config snippets | [] | [examples ](/advanced/customization/ ) |
2018-02-27 07:16:34 +01:00
| service_cidr | Must match `service_cidr` of cluster | "10.3.0.0/16" | "10.3.0.0/24" |
2019-09-29 00:01:14 +02:00
| node_labels | List of initial node labels | [] | ["worker-pool=foo"] |
2018-02-26 23:06:18 +01:00
Check the list of valid [machine types ](https://cloud.google.com/compute/docs/machine-types ).