kubernetes_horizontal_pod_autoscaler

Horizontal Pod Autoscaler automatically scales the number of pods in a replication controller, deployment or replica set based on observed CPU utilization.

Example Usage

resource "kubernetes_horizontal_pod_autoscaler" "example" {
  metadata {
    name = "terraform-example"
  }
  spec {
    max_replicas = 10
    min_replicas = 8
    scale_target_ref {
      kind = "ReplicationController"
      name = "MyApp"
    }
  }
}

Argument Reference

The following arguments are supported:

Nested Blocks

metadata

Arguments

Attributes

spec

Arguments

  • max_replicas - (Required) Upper limit for the number of pods that can be set by the autoscaler.
  • min_replicas - (Optional) Lower limit for the number of pods that can be set by the autoscaler, defaults to 1.
  • scale_target_ref - (Required) Reference to scaled resource. e.g. Replication Controller
  • target_cpu_utilization_percentage - (Optional) Target average CPU utilization (represented as a percentage of requested CPU) over all the pods. If not specified the default autoscaling policy will be used.

scale_target_ref

Arguments

Import

Horizontal Pod Autoscaler can be imported using the namespace and name, e.g.

$ terraform import kubernetes_horizontal_pod_autoscaler.example default/terraform-example