Add support for Flatcar Linux on Azure

* Accept `os_image` "flatcar-stable" and "flatcar-beta" to
use Kinvolk's Flatcar Linux images from the Azure Marketplace

Note: Flatcar Linux Azure Marketplace images require terms be
accepted before use
This commit is contained in:
Dalton Hubble 2020-03-10 23:55:23 -07:00
parent ab7913a061
commit 4e1b8f22df
7 changed files with 46 additions and 8 deletions

View File

@ -21,6 +21,8 @@ Notable changes between versions.
* Switch to Azure's new Linux VM and Linux VM Scale Set resources * Switch to Azure's new Linux VM and Linux VM Scale Set resources
* Set controller's Azure disk caching to None * Set controller's Azure disk caching to None
* Associate subnets (in addition to NICs) with security groups (aesthetic) * Associate subnets (in addition to NICs) with security groups (aesthetic)
* Add support for Flatcar Container Linux ([#664](https://github.com/poseidon/typhoon/pull/664))
* Requires accepting Flatcar Linux Azure Marketplace terms
#### Bare-Metal #### Bare-Metal

View File

@ -42,6 +42,7 @@ Typhoon is available for [Flatcar Container Linux](https://www.flatcar-linux.org
| Platform | Operating System | Terraform Module | Status | | Platform | Operating System | Terraform Module | Status |
|---------------|------------------|------------------|--------| |---------------|------------------|------------------|--------|
| AWS | Flatcar Linux | [aws/container-linux/kubernetes](aws/container-linux/kubernetes) | stable | | AWS | Flatcar Linux | [aws/container-linux/kubernetes](aws/container-linux/kubernetes) | stable |
| Azure | Flatcar Linux | [azure/container-linux/kubernetes](azure/container-linux/kubernetes) | alpha |
| Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](bare-metal/container-linux/kubernetes) | stable | | Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](bare-metal/container-linux/kubernetes) | stable |
| Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](google-cloud/container-linux/kubernetes) | alpha | | Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](google-cloud/container-linux/kubernetes) | alpha |
| Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](digital-ocean/container-linux/kubernetes) | alpha | | Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](digital-ocean/container-linux/kubernetes) | alpha |

View File

@ -15,8 +15,10 @@ resource "azurerm_dns_a_record" "etcds" {
} }
locals { locals {
# Channel for a Container Linux derivative # Container Linux derivative
# coreos-stable -> Container Linux Stable # coreos-stable -> Container Linux Stable
# flatcar-stable -> Flatcar Linux Stable
flavor = split("-", var.os_image)[0]
channel = split("-", var.os_image)[1] channel = split("-", var.os_image)[1]
} }
@ -52,12 +54,23 @@ resource "azurerm_linux_virtual_machine" "controllers" {
} }
source_image_reference { source_image_reference {
publisher = "CoreOS" publisher = local.flavor == "flatcar" ? "Kinvolk" : "CoreOS"
offer = "CoreOS" offer = local.flavor == "flatcar" ? "flatcar-container-linux" : "CoreOS"
sku = local.channel sku = local.channel
version = "latest" version = "latest"
} }
# Gross hack just for Flatcar Linux
dynamic "plan" {
for_each = local.flavor == "flatcar" ? [1] : []
content {
name = local.channel
publisher = "kinvolk"
product = "flatcar-container-linux"
}
}
# network # network
network_interface_ids = [ network_interface_ids = [
azurerm_network_interface.controllers.*.id[count.index] azurerm_network_interface.controllers.*.id[count.index]

View File

@ -49,7 +49,7 @@ variable "worker_type" {
variable "os_image" { variable "os_image" {
type = string type = string
default = "coreos-stable" default = "coreos-stable"
description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha)" description = "Channel for a Container Linux derivative (coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta)"
} }
variable "disk_size" { variable "disk_size" {

View File

@ -1,6 +1,7 @@
locals { locals {
# Channel for a Container Linux derivative
# coreos-stable -> Container Linux Stable # coreos-stable -> Container Linux Stable
# flatcar-stable -> Flatcar Linux Stable
flavor = split("-", var.os_image)[0]
channel = split("-", var.os_image)[1] channel = split("-", var.os_image)[1]
} }
@ -24,12 +25,23 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" {
} }
source_image_reference { source_image_reference {
publisher = "CoreOS" publisher = local.flavor == "flatcar" ? "Kinvolk" : "CoreOS"
offer = "CoreOS" offer = local.flavor == "flatcar" ? "flatcar-container-linux" : "CoreOS"
sku = local.channel sku = local.channel
version = "latest" version = "latest"
} }
# Gross hack just for Flatcar Linux
dynamic "plan" {
for_each = local.flavor == "flatcar" ? [1] : []
content {
name = local.channel
publisher = "kinvolk"
product = "flatcar-container-linux"
}
}
# Azure requires setting admin_ssh_key, though Ignition custom_data handles it too # Azure requires setting admin_ssh_key, though Ignition custom_data handles it too
admin_username = "core" admin_username = "core"
admin_ssh_key { admin_ssh_key {

View File

@ -85,6 +85,15 @@ module "ramius" {
Reference the [variables docs](#variables) or the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/container-linux/kubernetes/variables.tf) source. Reference the [variables docs](#variables) or the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/container-linux/kubernetes/variables.tf) source.
### Flatcar Linux Only
Flatcar Linux publishes images to the Azure Marketplace and requires accepting their legal terms.
```
az vm image terms show --publish kinvolk --offer flatcar-container-linux --plan stable
az vm image terms accept --publish kinvolk --offer flatcar-container-linux --plan stable
```
## ssh-agent ## ssh-agent
Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`. Initial bootstrapping requires `bootstrap.service` be started on one controller node. Terraform uses `ssh-agent` to automate this step. Add your SSH private key to `ssh-agent`.
@ -223,7 +232,7 @@ Reference the DNS zone with `azurerm_dns_zone.clusters.name` and its resource gr
| worker_count | Number of workers | 1 | 3 | | worker_count | Number of workers | 1 | 3 |
| controller_type | Machine type for controllers | "Standard_B2s" | See below | | controller_type | Machine type for controllers | "Standard_B2s" | See below |
| worker_type | Machine type for workers | "Standard_DS1_v2" | See below | | worker_type | Machine type for workers | "Standard_DS1_v2" | See below |
| os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha | | os_image | Channel for a Container Linux derivative | "coreos-stable" | coreos-stable, coreos-beta, coreos-alpha, flatcar-stable, flatcar-beta |
| disk_size | Size of the disk in GB | 40 | 100 | | disk_size | Size of the disk in GB | 40 | 100 |
| worker_priority | Set priority to Spot to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Spot | | worker_priority | Set priority to Spot to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time | Regular | Spot |
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/#usage) | | controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/#usage) |

View File

@ -42,6 +42,7 @@ Typhoon is available for [Flatcar Container Linux](https://www.flatcar-linux.org
| Platform | Operating System | Terraform Module | Status | | Platform | Operating System | Terraform Module | Status |
|---------------|------------------|------------------|--------| |---------------|------------------|------------------|--------|
| AWS | Flatcar Linux | [aws/container-linux/kubernetes](cl/aws.md) | stable | | AWS | Flatcar Linux | [aws/container-linux/kubernetes](cl/aws.md) | stable |
| Azure | Flatcar Linux | [azure/container-linux/kubernetes](cl/azure.md) | alpha |
| Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](cl/bare-metal.md) | stable | | Bare-Metal | Flatcar Linux | [bare-metal/container-linux/kubernetes](cl/bare-metal.md) | stable |
| Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](cl/google-cloud.md) | alpha | | Google Cloud | Flatcar Linux | [google-cloud/container-linux/kubernetes](cl/google-cloud.md) | alpha |
| Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](cl/digital-ocean.md) | alpha | | Digital Ocean | Flatcar Linux | [digital-ocean/container-linux/kubernetes](cl/digital-ocean.md) | alpha |