From f406e30191d8b05ffb49d84377d4095b23b51c4c Mon Sep 17 00:00:00 2001 From: Florian Nowarre Date: Sun, 18 Sep 2022 23:32:06 +0200 Subject: [PATCH] add flatcar to hetzner --- contrib/terraform/hetzner/README.md | 6 +++--- contrib/terraform/hetzner/main.tf | 9 ++++++--- contrib/terraform/hetzner/versions.tf | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/contrib/terraform/hetzner/README.md b/contrib/terraform/hetzner/README.md index 79f48cbec..532e92c0a 100644 --- a/contrib/terraform/hetzner/README.md +++ b/contrib/terraform/hetzner/README.md @@ -59,8 +59,8 @@ Edit `default.tfvars` to match your requirement. Run Terraform to create the infrastructure. ```bash -terraform -chdir=../../contrib/terraform/hetzner init -terraform -chdir=../../contrib/terraform/hetzner/ apply --var-file=default.tfvars +terraform -chdir=./kubespray/contrib/terraform/hetzner/ init +terraform -chdir=./kubespray/contrib/terraform/hetzner/ apply --var-file=./kubespray/inventory/my-hetzner-cluster/default.tfvars ``` You should now have a inventory file named `inventory.ini` that you can use with kubespray. @@ -75,7 +75,7 @@ ansible -i inventory.ini -m ping all You can setup Kubernetes with kubespray using the generated inventory: ```bash -ansible-playbook -i inventory.ini ../../cluster.yml -b -v +ansible-playbook -i inventory.ini ./kubespray/cluster.yml -b -v ``` ## Cloud controller diff --git a/contrib/terraform/hetzner/main.tf b/contrib/terraform/hetzner/main.tf index 6fb3ccf71..fc2f27108 100644 --- a/contrib/terraform/hetzner/main.tf +++ b/contrib/terraform/hetzner/main.tf @@ -1,7 +1,8 @@ provider "hcloud" {} module "kubernetes" { - source = "./modules/kubernetes-cluster-flatcar" + source = "./modules/kubernetes-cluster" + #source = "./modules/kubernetes-cluster-flatcar" prefix = var.prefix @@ -9,7 +10,9 @@ module "kubernetes" { machines = var.machines - ssh_private_key_path = var.ssh_private_key_path + #only for flatcar + #ssh_private_key_path = var.ssh_private_key_path + ssh_public_keys = var.ssh_public_keys network_zone = var.network_zone @@ -50,4 +53,4 @@ resource "null_resource" "inventories" { triggers = { template = data.template_file.inventory.rendered } -} +} \ No newline at end of file diff --git a/contrib/terraform/hetzner/versions.tf b/contrib/terraform/hetzner/versions.tf index 0c1889428..02e5b74ee 100644 --- a/contrib/terraform/hetzner/versions.tf +++ b/contrib/terraform/hetzner/versions.tf @@ -7,9 +7,9 @@ terraform { null = { source = "hashicorp/null" } - #template = { - # source = "hashicorp/template" - #} + template = { + source = "hashicorp/template" + } } required_version = ">= 0.14" }