Skip to content

Commit

Permalink
feat: create a k8s cluster with two different node pools to run k6 te…
Browse files Browse the repository at this point in the history
…sts from
  • Loading branch information
monteiro-renato committed Dec 5, 2024
1 parent c68f94f commit d502c4f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "azurerm_monitor_workspace" "k6tests_amw" {
name = "k6tests-amw"
resource_group_name = azurerm_resource_group.k6tests_rg.name
location = azurerm_resource_group.k6tests_rg.location
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
resource "azurerm_kubernetes_cluster" "k6tests" {
name = "k6tests-cluster"
location = azurerm_resource_group.k6tests_rg.location
resource_group_name = azurerm_resource_group.k6tests_rg.name
dns_prefix = "k6tests-cluster"

default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
}

workload_identity_enabled = true
oidc_issuer_enabled = true

identity {
type = "SystemAssigned"
}
}

resource "azurerm_kubernetes_cluster_node_pool" "spot" {
name = "spot"
kubernetes_cluster_id = azurerm_kubernetes_cluster.k6tests.id
vm_size = "Standard_DS2_v2"
auto_scaling_enabled = true
node_count = 0
min_count = 0
max_count = 1
priority = "Spot"
eviction_policy = "Delete"
spot_max_price = -1 # (the current on-demand price for a Virtual Machine)
node_labels = {
spot : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
backend "azurerm" {
use_azuread_auth = true
}
}
provider "azurerm" {
subscription_id = "1ce8e9af-c2d6-44e7-9c5e-099a308056fe"
features {}
resource_providers_to_register = [
"Microsoft.Monitor",
"Microsoft.AlertsManagement",
"Microsoft.Dashboard",
"Microsoft.KubernetesConfiguration"
]
}
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "azurerm_resource_group" "k6tests_rg" {
name = "k6tests-rg"
location = "norwayeast"
}

0 comments on commit d502c4f

Please sign in to comment.