# Kubernetes
## Example Usage
```hcl
resource "e2e_kubernetes" "kubernetes1" {
name = "kubernetes_cluster_v1"
version = "1.30" //Just an example
project_id = 30000 //Just an example
location = "Delhi"
vpc_id = "10001" //Just an example
security_group_ids = [682, 683, 684] //List of security group IDs
subnet_id = "12345" //Optional, only for custom VPC
node_pools {
name = "node_pool_1"
specs_name = "C3.8GB"
node_pool_type = "Static"
worker_node = 2
}
node_pools {
name = "node_pool_2"
specs_name = "C3.8GB"
node_pool_type = "Autoscale"
min_vms = 2
max_vms = 4
scheduled_dict {
worker {
scheduled_policies {
upscale_cardinality = 4
upscale_recurrence = "0 12 * * *"
downscale_cardinality = 2
downscale_recurrence = "0 2 * * *"
}
}
}
}
node_pools {
name = "wnpn_v3"
specs_name = "C3.8GB"
node_pool_type = "Autoscale"
min_vms = 2
max_vms = 4
scheduled_dict {
worker {
scheduled_policies {
upscale_cardinality = 4
upscale_recurrence = "0 12 * * *"
downscale_cardinality = 2
downscale_recurrence = "0 2 * * *"
}
}
}
elasticity_dict {
worker {
period_number = 3
parameter = "NETWORK_TRAFFIC"
policy_paramter_type = "Custom"
elasticity_policies {
operator = ">"
value = 60
period = 10
watch_period = 3
cooldown = 150
}
elasticity_policies {
operator = "<"
value = 30
period = 10
watch_period = 3
cooldown = 150
}
}
}
}
}
```
## Schema
### Required
- `name` (String) The name of the Kubernetes service
- `node_pools` (Block List, Min: 1) List of worker node pools (see [below for nested schema](#nestedblock--node_pools))
- `project_id` (Number) ID of the project. It should be unique
- `version` (String) Version of the Kubernetes service
- `vpc_id` (String) VPC ID of the Kubernetes service
- `security_group_ids` (List of Numbers) List of security group IDs to attach to the cluster. At least one security group is required. Can be updated after creation to attach/detach security groups.Attach one security group at time of creation. To find the security group id, please refer to our
- `location` (String) Location of the block storage
### Optional
- `subnet_id` (String) Subnet ID of the custom VPC (applicable only if a custom VPC is used).
### Read-Only
- `created_at` (String) Creation time of the Kubernetes Service
- `id` (String) The ID of this resource.
- `sku_id` (String) SKU ID of the Kubernetes service
- `slug_name` (String) Slug name of the Kubernetes service
- `status` (String) This is the status of the Kubernetes Service, only to get the status from my account.
### Nested Schema for `node_pools`
Required:
- `name` (String) Name of the worker node pool
- `node_pool_type` (String) Its value can be Autoscale or Static
- `specs_name` (String) Specs name of the worker node pool
Optional:
- `elasticity_dict` (Block List) Elasticity dictionary for the worker node pool (Only In case of Autoscale Node Pool Type) (see [below for nested schema](#nestedblock--node_pools--elasticity_dict))
- `max_vms` (Number) Maximum number of virtual machines (Only In case of Autoscale Node Pool Type)
- `min_vms` (Number) Minimum number of virtual machines (Only In case of Autoscale Node Pool Type)
- `node_pool_size` (Number) Only to be used during updation if you want to resize a node pool.
- `scheduled_dict` (Block List) Scheduled dictionary for the worker node pool (Only In case of Autoscale Node Pool Type) (see [below for nested schema](#nestedblock--node_pools--scheduled_dict))
- `worker_node` (Number) Number of worker nodes in the pool (In case of Static Node Pool only)
Read-Only:
- `cardinality` (Number) Cardinality computed from min_vms during creation
- `custom_param_name` (String) Custom parameter name for the worker node pool
- `custom_param_value` (String) Custom parameter value for the worker node pool
- `policy_type` (String) Policy type for the worker node pool
- `service_id` (String) Services ID of the worker node pool
- `sku_id` (String) SKU ID of the worker node pool
- `slug_name` (String) Slug name of the worker node pool
### Nested Schema for `node_pools.elasticity_dict`
Optional:
- `worker` (Block List) Worker settings in the elasticity dictionary (see [below for nested schema](#nestedblock--node_pools--elasticity_dict--worker))
### Nested Schema for `node_pools.elasticity_dict.worker`
Required:
- `elasticity_policies` (Block List, Min: 1) List of elasticity policies (see [below for nested schema](#nestedblock--node_pools--elasticity_dict--worker--elasticity_policies))
- `period_number` (Number) Period number
- `policy_parameter_type` (String) Its value can be Default or Custom. If it is custom then you must provide the parameter field.
Optional:
- `parameter` (String) Parameter (e.g., CPU, Memory)
### Nested Schema for `node_pools.elasticity_dict.worker.elasticity_policies`
Required:
- `cooldown` (Number) Cooldown
- `operator` (String) Operator for adding worker (e.g., >, >=)
- `period` (Number) Period
- `value` (Number) Value for adding worker
- `watch_period` (Number) Period Number
### Nested Schema for `node_pools.scheduled_dict`
Optional:
- `worker` (Block List) Worker settings in the scheduled dictionary (see [below for nested schema](#nestedblock--node_pools--scheduled_dict--worker))
### Nested Schema for `node_pools.scheduled_dict.worker`
Required:
- `scheduled_policies` (Block List, Min: 1) (see [below for nested schema](#nestedblock--node_pools--scheduled_dict--worker--scheduled_policies))
### Nested Schema for `node_pools.scheduled_dict.worker.scheduled_policies`
Required:
- `downscale_cardinality` (Number) The cardinality for downscaling
- `downscale_recurrence` (String) The recurrence timing for downscaling
- `upscale_cardinality` (Number) The cardinality for upscaling
- `upscale_recurrence` (String) The recurrence timing for upscaling
---