k8s cluster 2+1 CX23
This commit is contained in:
parent
8a425e4318
commit
468fd67b92
7 changed files with 110 additions and 0 deletions
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
.terraform/
|
||||
*.tfstate
|
||||
*.tfstate.backup
|
||||
*.tfvars
|
||||
!*.tfvars.example
|
||||
kubeconfig
|
||||
talosconfig
|
||||
.terraform.lock.hcl
|
||||
backend.conf
|
||||
.claude
|
||||
32
main.tf
Normal file
32
main.tf
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
module "kubernetes" {
|
||||
source = "hcloud-k8s/kubernetes/hcloud"
|
||||
version = "3.27.2"
|
||||
|
||||
cluster_name = var.cluster_name
|
||||
hcloud_token = var.hcloud_token
|
||||
|
||||
cluster_kubeconfig_path = "kubeconfig"
|
||||
cluster_talosconfig_path = "talosconfig"
|
||||
|
||||
firewall_use_current_ipv4 = true
|
||||
|
||||
cert_manager_enabled = true
|
||||
|
||||
control_plane_nodepools = [
|
||||
{
|
||||
name = "control"
|
||||
type = "cx23" # 2 vCPU, 4 GB RAM
|
||||
location = "hel1"
|
||||
count = 1
|
||||
}
|
||||
]
|
||||
|
||||
worker_nodepools = [
|
||||
{
|
||||
name = "worker"
|
||||
type = "cx23" # 2 vCPU, 4 GB RAM
|
||||
location = "hel1"
|
||||
count = 2
|
||||
}
|
||||
]
|
||||
}
|
||||
7
outputs.tf
Normal file
7
outputs.tf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
output "control_plane_public_ipv4_list" {
|
||||
value = module.kubernetes.control_plane_public_ipv4_list
|
||||
}
|
||||
|
||||
output "worker_public_ipv4_list" {
|
||||
value = module.kubernetes.worker_public_ipv4_list
|
||||
}
|
||||
29
providers.tf
Normal file
29
providers.tf
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "k8s-asxpio-main"
|
||||
key = "terraform/state/terraform.tfstate"
|
||||
region = "hel1"
|
||||
endpoint = "https://hel1.your-objectstorage.com"
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
skip_region_validation = true
|
||||
skip_requesting_account_id = true
|
||||
force_path_style = true
|
||||
}
|
||||
|
||||
required_providers {
|
||||
helm = {
|
||||
source = "hashicorp/helm"
|
||||
version = ">= 2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "helm" {
|
||||
kubernetes = {
|
||||
host = module.kubernetes.kubeconfig_data.server
|
||||
cluster_ca_certificate = module.kubernetes.kubeconfig_data.ca
|
||||
client_certificate = module.kubernetes.kubeconfig_data.cert
|
||||
client_key = module.kubernetes.kubeconfig_data.key
|
||||
}
|
||||
}
|
||||
2
terraform.tfvars.example
Normal file
2
terraform.tfvars.example
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
hcloud_token = "your-hetzner-cloud-api-token"
|
||||
cluster_name = "k8s"
|
||||
21
traefik.tf
Normal file
21
traefik.tf
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
resource "helm_release" "traefik" {
|
||||
name = "traefik"
|
||||
namespace = "traefik"
|
||||
create_namespace = true
|
||||
repository = "https://traefik.github.io/charts"
|
||||
chart = "traefik"
|
||||
version = "35.0.1"
|
||||
|
||||
set = [
|
||||
{
|
||||
name = "providers.kubernetesCRD.enabled"
|
||||
value = "true"
|
||||
},
|
||||
{
|
||||
name = "providers.kubernetesIngress.enabled"
|
||||
value = "true"
|
||||
}
|
||||
]
|
||||
|
||||
depends_on = [module.kubernetes]
|
||||
}
|
||||
9
variables.tf
Normal file
9
variables.tf
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
variable "cluster_name" {
|
||||
type = string
|
||||
default = "k8s-asxpio"
|
||||
}
|
||||
|
||||
variable "hcloud_token" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue