Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can GKE POD Horizontal Autoscaling be available with Memory Utilization Metrics through Terraform IAC? #2544

Closed
savitapal8 opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels

Comments

@savitapal8
Copy link

Terraform version, Kubernetes provider version and Kubernetes version

Terraform version:
Kubernetes Provider version:
Kubernetes version:

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]     }

Question

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 above 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"
@appilon
Copy link
Contributor

appilon commented Jul 10, 2024

The provider is merely a passthrough for the k8s API. It's very unlikely TF works for CPU but not Memory, it should support all the metric Kubernetes supports. I'm going to close this issue/question as I don't think there's anything actionable we can provide at this time.

@appilon appilon closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants