diff --git a/CHANGES.md b/CHANGES.md index b78e41ff..c740f28a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,10 +17,10 @@ Notable changes between versions. ### Flatcar Linux +* Add Flatcar Linux ARM64 support on Azure ([docs](https://typhoon.psdn.io/advanced/arm64/), [#1251](https://github.com/poseidon/typhoon/pull/1251)) * Switch from Azure Hypervisor gen1 to gen2 (**action required**) ([#1248](https://github.com/poseidon/typhoon/pull/1248)) * Run `az vm image terms accept --publish kinvolk --offer flatcar-container-linux-free --plan stable-gen2` - ### Addons * Update Prometheus from v2.38.0 to [v2.39.1](https://github.com/prometheus/prometheus/releases/tag/v2.39.1) diff --git a/README.md b/README.md index 46a901c8..36c07f34 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Typhoon is available for [Flatcar Linux](https://www.flatcar-linux.org/releases/ | Platform | Operating System | Terraform Module | Status | |---------------|------------------|------------------|--------| | AWS | Flatcar Linux (ARM64) | [aws/flatcar-linux/kubernetes](aws/flatcar-linux/kubernetes) | alpha | +| Azure | Flatcar Linux (ARM64) | [azure/flatcar-linux/kubernetes](azure/flatcar-linux/kubernetes) | alpha | ## Documentation diff --git a/azure/flatcar-linux/kubernetes/controllers.tf b/azure/flatcar-linux/kubernetes/controllers.tf index efe80075..f156472d 100644 --- a/azure/flatcar-linux/kubernetes/controllers.tf +++ b/azure/flatcar-linux/kubernetes/controllers.tf @@ -17,7 +17,9 @@ resource "azurerm_dns_a_record" "etcds" { locals { # Container Linux derivative # flatcar-stable -> Flatcar Linux Stable - channel = split("-", var.os_image)[1] + channel = split("-", var.os_image)[1] + offer_suffix = var.arch == "arm64" ? "corevm" : "free" + urn = var.arch == "arm64" ? local.channel : "${local.channel}-gen2" } # Controller availability set to spread controllers @@ -54,15 +56,18 @@ resource "azurerm_linux_virtual_machine" "controllers" { # Flatcar Container Linux source_image_reference { publisher = "kinvolk" - offer = "flatcar-container-linux-free" - sku = "${local.channel}-gen2" + offer = "flatcar-container-linux-${local.offer_suffix}" + sku = local.urn version = "latest" } - plan { - publisher = "kinvolk" - product = "flatcar-container-linux-free" - name = "${local.channel}-gen2" + dynamic "plan" { + for_each = var.arch == "arm64" ? [] : [1] + content { + publisher = "kinvolk" + product = "flatcar-container-linux-${local.offer_suffix}" + name = local.urn + } } # network diff --git a/azure/flatcar-linux/kubernetes/variables.tf b/azure/flatcar-linux/kubernetes/variables.tf index ce3baf12..76c09d4e 100644 --- a/azure/flatcar-linux/kubernetes/variables.tf +++ b/azure/flatcar-linux/kubernetes/variables.tf @@ -133,6 +133,17 @@ variable "worker_node_labels" { default = [] } +variable "arch" { + type = string + description = "Container architecture (amd64 or arm64)" + default = "amd64" + + validation { + condition = var.arch == "amd64" || var.arch == "arm64" + error_message = "The arch must be amd64 or arm64." + } +} + variable "daemonset_tolerations" { type = list(string) description = "List of additional taint keys kube-system DaemonSets should tolerate (e.g. ['custom-role', 'gpu-role'])" diff --git a/azure/flatcar-linux/kubernetes/workers.tf b/azure/flatcar-linux/kubernetes/workers.tf index 808c473f..c775de2a 100644 --- a/azure/flatcar-linux/kubernetes/workers.tf +++ b/azure/flatcar-linux/kubernetes/workers.tf @@ -21,4 +21,5 @@ module "workers" { cluster_domain_suffix = var.cluster_domain_suffix snippets = var.worker_snippets node_labels = var.worker_node_labels + arch = var.arch } diff --git a/azure/flatcar-linux/kubernetes/workers/variables.tf b/azure/flatcar-linux/kubernetes/workers/variables.tf index c2537b4b..2bab9215 100644 --- a/azure/flatcar-linux/kubernetes/workers/variables.tf +++ b/azure/flatcar-linux/kubernetes/workers/variables.tf @@ -100,6 +100,17 @@ variable "node_taints" { default = [] } +variable "arch" { + type = string + description = "Container architecture (amd64 or arm64)" + default = "amd64" + + validation { + condition = var.arch == "amd64" || var.arch == "arm64" + error_message = "The arch must be amd64 or arm64." + } +} + # unofficial, undocumented, unsupported variable "cluster_domain_suffix" { diff --git a/azure/flatcar-linux/kubernetes/workers/workers.tf b/azure/flatcar-linux/kubernetes/workers/workers.tf index 9c9ef059..f992d7cd 100644 --- a/azure/flatcar-linux/kubernetes/workers/workers.tf +++ b/azure/flatcar-linux/kubernetes/workers/workers.tf @@ -1,6 +1,8 @@ locals { # flatcar-stable -> Flatcar Linux Stable - channel = split("-", var.os_image)[1] + channel = split("-", var.os_image)[1] + offer_suffix = var.arch == "arm64" ? "corevm" : "free" + urn = var.arch == "arm64" ? local.channel : "${local.channel}-gen2" } # Workers scale set @@ -25,15 +27,18 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" { # Flatcar Container Linux source_image_reference { publisher = "kinvolk" - offer = "flatcar-container-linux-free" - sku = "${local.channel}-gen2" + offer = "flatcar-container-linux-${local.offer_suffix}" + sku = local.urn version = "latest" } - plan { - publisher = "kinvolk" - product = "flatcar-container-linux-free" - name = "${local.channel}-gen2" + dynamic "plan" { + for_each = var.arch == "arm64" ? [] : [1] + content { + publisher = "kinvolk" + product = "flatcar-container-linux-${local.offer_suffix}" + name = local.urn + } } # Azure requires setting admin_ssh_key, though Ignition custom_data handles it too diff --git a/docs/advanced/arm64.md b/docs/advanced/arm64.md index 6f3a99c7..a8e60813 100644 --- a/docs/advanced/arm64.md +++ b/docs/advanced/arm64.md @@ -1,10 +1,15 @@ # ARM64 -Typhoon supports ARM64 on AWS, with Fedora CoreOS or Flatcar Linux. Clusters can be created with ARM64 controller and worker nodes. Or worker pools of ARM64 nodes can be attached to an AMD64 cluster to create a hybrid/mixed architecture cluster. +Typhoon supports ARM64 Kubernetes clusters with ARM64 controller and worker nodes (full-cluster) or adding worker pools of ARM64 nodes to clusters with an x86/amd64 control plane for a hybdrid (mixed-arch) cluster. + +Typhoon ARM64 clusters (full-cluster or mixed-arch) are available on: + +* AWS with Fedora CoreOS or Flatcar Linux +* Azure with Flatcar Linux ## Cluster -Create a cluster with ARM64 controller and worker nodes. Container workloads must be `arm64` compatible and use `arm64` container images. +Create a cluster on AWS with ARM64 controller and worker nodes. Container workloads must be `arm64` compatible and use `arm64` (or multi-arch) container images. === "Fedora CoreOS Cluster (arm64)" @@ -174,3 +179,29 @@ ip-10-0-22-79... Ready 111m v1.25.3 10.0.22.79 111m v1.25.3 10.0.24.130 Fedora CoreOS 35.20211215.3.0 5.15.7-200.fc35.x86_64 containerd://1.5.8 ip-10-0-39-19 Ready 111m v1.25.3 10.0.39.19 Fedora CoreOS 35.20211215.3.0 5.15.7-200.fc35.x86_64 containerd://1.5.8 ``` + +## Azure + +Create a cluster on Azure with ARM64 controller and worker nodes. Container workloads must be `arm64` compatible and use `arm64` (or multi-arch) container images. + +```tf +module "ramius" { + source = "git::https://github.com/poseidon/typhoon//azure/flatcar-linux/kubernetes?ref=v1.25.3" + + # Azure + cluster_name = "ramius" + region = "centralus" + dns_zone = "azure.example.com" + dns_zone_group = "example-group" + + # configuration + ssh_authorized_key = "ssh-rsa AAAAB3Nz..." + + # optional + arch = "arm64" + controller_type = "Standard_D2pls_v5" + worker_type = "Standard_D2pls_v5" + worker_count = 2 + host_cidr = "10.0.0.0/20" +} +``` diff --git a/docs/index.md b/docs/index.md index 449420e1..c11ae4f6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -48,6 +48,7 @@ Typhoon is available for [Flatcar Linux](https://www.flatcar-linux.org/releases/ | Platform | Operating System | Terraform Module | Status | |---------------|------------------|------------------|--------| | AWS | Flatcar Linux (ARM64) | [aws/flatcar-linux/kubernetes](advanced/arm64.md) | alpha | +| Azure | Flatcar Linux (ARM64) | [azure/flatcar-linux/kubernetes](advanced/arm64.md) | alpha | ## Documentation