hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider
https://www.terraform.io/docs/providers/kubernetes/
Mozilla Public License 2.0
1.6k stars 979 forks source link

GKE POD Horizontal Autoscaling need to enable with Memory Utilization Metrics through Terraform IAC #2545

Closed savitapal8 closed 4 months ago

savitapal8 commented 4 months ago

Description

I need to make enable GKE POD Horizontal Autoscaling with Memory Utilization Metrics through terraform IAC. I found code with CPU Utilization, but not for Memory Utilization Metrics.

I also tried with following code but getting below error after applying terraform pipeline

ERROR Message:

[2024-07-09 10:50:07] Error: the server could not find the requested resource [2024-07-09 10:50:07] [2024-07-09 10:50:07] releases, based on feedback. [2024-07-09 10:50:07] [2024-07-09 10:50:07] If you have feedback on the design of this feature, please open a GitHub issue [2024-07-09 10:50:07] to discuss it. [2024-07-09 10:50:07] [2024-07-09 10:50:07] (and 7 more similar warnings elsewhere) [2024-07-09 10:50:07] [2024-07-09 10:50:07] on .terraform/modules/query_service_dev1.query_service/k8s_hpa.tf line 32, in resource "kubernetes_horizontal_pod_autoscaler" "hpa": [2024-07-09 10:50:07] 32: resource "kubernetes_horizontal_pod_autoscaler" "hpa"

Potential Terraform Configuration

+ resource "kubernetes_horizontal_pod_autoscaler" "hpa" {
[2024-07-09 10:49:37]       + id = (known after apply)
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]       + metadata {
[2024-07-09 10:49:37]           + generation       = (known after apply)
[2024-07-09 10:49:37]           + labels           = {
[2024-07-09 10:49:37]               + "app"     = "query-service"
[2024-07-09 10:49:37]               + "dept"    = "Sentinels"
[2024-07-09 10:49:37]               + "name"    = "query-service"
[2024-07-09 10:49:37]               + "part-of" = "Foundry"
[2024-07-09 10:49:37]             }
[2024-07-09 10:49:37]           + name             = "query-service"
[2024-07-09 10:49:37]           + namespace        = "dev1-e2-dev1-ssrs-query"
[2024-07-09 10:49:37]           + resource_version = (known after apply)
[2024-07-09 10:49:37]           + uid              = (known after apply)
[2024-07-09 10:49:37]         }
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]       + spec {
[2024-07-09 10:49:37]           + max_replicas                      = 3
[2024-07-09 10:49:37]           + min_replicas                      = 1
[2024-07-09 10:49:37]           + target_cpu_utilization_percentage = (known after apply)
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]           + metric {
[2024-07-09 10:49:37]               + type = "Resource"
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]               + resource {
[2024-07-09 10:49:37]                   + name = "cpu"
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]                   + target {
[2024-07-09 10:49:37]                       + average_utilization = 80
[2024-07-09 10:49:37]                       + type                = "Utilization"
[2024-07-09 10:49:37]                     }
[2024-07-09 10:49:37]                 }
[2024-07-09 10:49:37]             }
[2024-07-09 10:49:37]           + metric {
[2024-07-09 10:49:37]               + type = "Resource"
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]               + resource {
[2024-07-09 10:49:37]                   + name = "memory"
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]                   + target {
[2024-07-09 10:49:37]                       + average_utilization = 80
[2024-07-09 10:49:37]                       + type                = "Utilization"
[2024-07-09 10:49:37]                     }
[2024-07-09 10:49:37]                 }
[2024-07-09 10:49:37]             }
[2024-07-09 10:49:37] 
[2024-07-09 10:49:37]           + scale_target_ref {
[2024-07-09 10:49:37]               + api_version = "apps/v1"
[2024-07-09 10:49:37]               + kind        = "Deployment"
[2024-07-09 10:49:37]               + name        = "query-service"
[2024-07-09 10:49:37]             }
[2024-07-09 10:49:37]         }
[2024-07-09 10:49:37]     }

References

Community Note

appilon commented 4 months ago

I am going to try and take a look at your question over at #2544. Closing this issue unless a bug is unearthed.