Terraform module to create a K8s (SKE) Cluster with monitoring (Argus) for STACKIT cloud platform.
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
This Terraform project provisions a Kubernetes cluster on STACKIT, including optional Argus monitoring and ACL controls.
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
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.
Auto start/stop timings for the cluster can be set through the var.hibernations
variable to save on costs.
There are two STACKIT Terraform providers:
- Community: SchwarzIT/stackit
- Official: stackitcloud/stackit
The official provider is still buggy, so we are using the Community provider for now.
Pull requests are very welcome. If you encounter any problems, please open an issue ❤️.
MIT
Name | Version |
---|---|
stackit | ~> 1.27 |
Name | Version |
---|---|
local | n/a |
stackit | ~> 1.27 |
No modules.
Name | Type |
---|---|
local_sensitive_file.kubeconfig | resource |
stackit_argus_instance.default | resource |
stackit_kubernetes_cluster.default | resource |
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({ |
{ |
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({ |
{ |
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({ |
{ |
no |
grafana | Argus grafana configuration | object({ |
{ |
no |
hibernations | Hibernation configuration | list(object({ |
[ |
no |
k8s_version | K8s Version | string |
"1.26" |
no |
maintenance | Maintenance window configuration | object({ |
{ |
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({ |
{ |
no |
node_pools | Configuration for node_pools | list(object({ |
n/a | yes |
project_id | stackit Project ID | any |
n/a | yes |
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 |