Skip to content

Terraform module to deploy STACKIT Kubernetes (SKE) Cluster with optional Argus monitoring

License

Notifications You must be signed in to change notification settings

ventx/terraform-stackit-k8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform STACKIT Kubernetes

Terraform module to create a K8s (SKE) Cluster with monitoring (Argus) for STACKIT cloud platform.

Consulting

You need support with STACKIT infrastructure? We are an official professional service partner of STACKIT !

Please don't hesitate to contact us at: stackit@ventx.de


Sie benötigen Unterstützung bei Ihrer STACKIT Infrastruktur? Wir sind offizieller Professional Service Partner von STACKIT !

Kontaktieren Sie uns via: stackit@ventx.de

Overview

This Terraform project provisions a Kubernetes cluster on STACKIT, including optional Argus monitoring and ACL controls.

Prerequisites

Getting Started

Clone the repository: git clone https://github.com/ventx/terraform-stackit-k8s

Navigate into the directory: cd terraform-stackit-k8s

Set your Stackit Service Account Token as EnvVars:

 export STACKIT_SERVICE_ACCOUNT_EMAIL=xxx
 export STACKIT_SERVICE_ACCOUNT_TOKEN=xxx

Create terraform.tfvars to configure Node Pools (required) and other configs (optional):

# REQUIRED: ID of your STACKIT project
project_id = "12345678-1234-1234-1234-1234567890ab"

# REQUIRED: Configure Node Pool(s)
node_pools = [
  {
    name         = "np-example"
    machine_type = "c1.2"
    minimum = "2"
    maximum = "3"
    zones   = ["eu01-1", "eu01-2", "eu01-3"]
  }
]

# Enables cluster monitoring with STACKIT Argus and configure ACL to whitelist CIDRs for cluster access
extensions = {
  acl = {
    enabled       = false
    allowed_cidrs = []
  },
  argus = {
    enabled = true
  }
}

# Automatically shutdown cluster at 18:00 and start at 08:00 to save on costs
hibernations = [{
  start    = "0 8 * * *"
  end      = "0 18 * * *"
  timezone = "Europe/Berlin"
}]

Initialize Terraform: terraform init

Create Terraform plan and verify the configuration: terraform plan

Apply the Terraform configuration: terraform apply

Maintenance & Monitoring

Scheduled maintenance (auto-update of K8s and/or machine images) is controlled by the var.maintenance variable block.

Optionally enable Argus monitoring via var.monitoring variable block.

Hibernation

Auto start/stop timings for the cluster can be set through the var.hibernations variable to save on costs.

Important Notes

Terraform Providers

There are two STACKIT Terraform providers:

The official provider is still buggy, so we are using the Community provider for now.

Contributing

Pull requests are very welcome. If you encounter any problems, please open an issue ❤️.

License

MIT

terraform-docs

Requirements

Name Version
stackit ~> 1.27

Providers

Name Version
local n/a
stackit ~> 1.27

Modules

No modules.

Resources

Name Type
local_sensitive_file.kubeconfig resource
stackit_argus_instance.default resource
stackit_kubernetes_cluster.default resource

Inputs

Name Description Type Default Required
acl_allowed_cidrs List of CIDRs to allow access to the cluster list(string) [] no
acl_enabled Enable / Disable ACL bool false no
argus_instance Argus instance configuration
object({
parameters = optional(map(string))
})
{
"parameters": {}
}
no
argus_instance_id Argus Instance ID for Monitoring of K8s Cluster string "" no
argus_plan Name of the Argus plan to use string "Monitoring-Starter-EU01" no
cluster_name Specifies the cluster name (lower case, alphanumeric, hyphens allowed, up to 11 chars) string "k8s" no
cluster_timeouts Timeouts for cluster operations
object({
create = optional(string)
update = optional(string)
delete = optional(string)
})
{
"create": "60m",
"delete": "60m",
"update": "60m"
}
no
create_local_kubeconfig Create local kubeconfig file bool true no
enable_kubernetes_version_updates Enable automatic Kubernetes version updates bool true no
enable_machine_image_version_updates Enable automatic OS image version updates bool true no
extensions Extensions configuration
object({
acl = object({
allowed_cidrs = list(string)
enabled = bool
})
argus = object({
enabled = bool
argus_instance_id = optional(string)
})
})
{
"acl": {
"allowed_cidrs": [],
"enabled": false
},
"argus": {
"enabled": false
}
}
no
grafana Argus grafana configuration
object({
enable_public_access = bool
})
{
"enable_public_access": false
}
no
hibernations Hibernation configuration
list(object({
start = string
end = string
timezone = string
}))
[
{
"end": "",
"start": "",
"timezone": "Europe/Berlin"
}
]
no
k8s_version K8s Version string "1.26" no
maintenance Maintenance window configuration
object({
enable_kubernetes_version_updates = bool
enable_machine_image_version_updates = bool
start = string
end = string
})
{
"enable_kubernetes_version_updates": true,
"enable_machine_image_version_updates": true,
"end": "0000-01-01T05:00:00Z",
"start": "0000-01-01T03:00:00Z"
}
no
maintenance_start Start of the maintenance window string "02:00:00+02:00" no
maintenance_stop End of the maintenance window string "05:00:00+02:00" no
metrics Argus metric configuration
object({
retention_days = number
retention_days_1h_downsampling = number
retention_days_5m_downsampling = number
})
{
"retention_days": 30,
"retention_days_1h_downsampling": 3,
"retention_days_5m_downsampling": 10
}
no
node_pools Configuration for node_pools
list(object({
machine_type = string
name = string
container_runtime = optional(string)
labels = optional(map(string))
max_surge = optional(number)
max_unavailable = optional(number)
maximum = optional(number)
minimum = optional(number)
os_name = optional(string)
os_version = optional(string)
taints = optional(list(object({
key = string
value = string
effect = string
})))
volume_size_gb = optional(number)
volume_type = optional(string)
zones = optional(list(string))
}))
n/a yes
project_id stackit Project ID any n/a yes

Outputs

Name Description
argus_alerting_url n/a
argus_dashboard_url n/a
argus_grafana_initial_admin_password n/a
argus_grafana_initial_admin_user n/a
argus_grafana_url n/a
argus_instance_id n/a
argus_jaeger_traces_url n/a
argus_jaeger_ui_url n/a
argus_logs_push_url n/a
argus_logs_url n/a
argus_metrics_push_url n/a
argus_metrics_url n/a
argus_otlp_traces_url n/a
argus_targets_url n/a
argus_zipkin_spans_url n/a
cluster_id n/a
cluster_version n/a
kube_config n/a

About

Terraform module to deploy STACKIT Kubernetes (SKE) Cluster with optional Argus monitoring

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages