From 7466d99799a8769176c4823bb56631a91cebe93b Mon Sep 17 00:00:00 2001 From: Dylan Jennings Date: Thu, 11 Jun 2020 13:13:46 +1200 Subject: [PATCH] Make scale_target_ref api_version match deployment In an attempt to fix the following error when creating the horizontal pod autoscaler: the HPA controller was unable to get the target's current scale: no matches for kind "Deployment" in group "" From what I can tell, this is caused when the referent (in this case the deployment) version is different to what the autoscaler expects. https://www.terraform.io/docs/providers/kubernetes/r/horizontal_pod_autoscaler.html#arguments-10 --- horizontal_pod_autoscaler.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/horizontal_pod_autoscaler.tf b/horizontal_pod_autoscaler.tf index 0eedaed..9a98a8f 100644 --- a/horizontal_pod_autoscaler.tf +++ b/horizontal_pod_autoscaler.tf @@ -12,8 +12,9 @@ resource "kubernetes_horizontal_pod_autoscaler" "ambassador" { target_cpu_utilization_percentage = var.autoscaling_target_cpu_utilization_percentage scale_target_ref { - kind = "Deployment" - name = var.name + api_version = "extensions/v1beta1" + kind = "Deployment" + name = var.name } }