learn-terraform-deploy-nginx-kubernetes-provider icon indicating copy to clipboard operation
learn-terraform-deploy-nginx-kubernetes-provider copied to clipboard

Error: Waiting for rollout to finish: 2 replicas wanted; 0 replicas Ready

Open beamsies opened this issue 3 years ago • 9 comments

I keep getting the following error:

╷ │ Error: Waiting for rollout to finish: 2 replicas wanted; 0 replicas Ready │ │ with kubernetes_deployment.nginx1, │ on kubernetes.tf line 33, in resource "kubernetes_deployment" "nginx1": │ 33: resource "kubernetes_deployment" "nginx1" { │ ╵

I'm following the tutorial here for the "kind" tab tutorial:

https://learn.hashicorp.com/tutorials/terraform/kubernetes-provider?in=terraform/use-case

Any ideas why this is happening?

Trying to learn with this tutorial but I have no idea why this keeps happening.

Thanks in advance!

beamsies avatar Aug 21 '21 17:08 beamsies

I am also getting the same error!

bsteveb avatar Feb 10 '22 03:02 bsteveb

did you find a solution? thanks:)

bsteveb avatar Feb 10 '22 03:02 bsteveb

are you on WSL2? this fixed it for me. was able to diagnose it by running this command

$ kubectl describe pod scalable-nginx-example-xxxx-xxxx
Name:         scalable-nginx-example-9cbcdbf9f-9nx88
Namespace:    default
...
Containers:
  example:
    ...
    Last State:     Terminated
      Reason:       Error
      Exit Code:    139 # <====
      Started:      Wed, 20 Apr 2022 13:36:49 +0800
      Finished:     Wed, 20 Apr 2022 13:36:49 +0800

ncdejito avatar Apr 20 '22 06:04 ncdejito

Same issue, how to resolve it.

Keshav-Thakur avatar Sep 21 '22 06:09 Keshav-Thakur

Hey, were you able to resolve the issue?

ProboticsX avatar Oct 02 '22 00:10 ProboticsX

Had the same problem. I fixed this by setting the CPU in the limits to 500m. Originally it was 0.5 that does not seem right. This is the working deployment:

resource "kubernetes_deployment" "nginx" {
  metadata {
    name = "scalable-nginx-example"
    labels = {
      App = "ScalableNginxExample"
    }
  }

  spec {
    replicas = 2
    selector {
      match_labels = {
        App = "ScalableNginxExample"
      }
    }
    template {
      metadata {
        labels = {
          App = "ScalableNginxExample"
        }
      }
      spec {
        container {
          image = "nginx:1.7.8"
          name  = "example"

          port {
            container_port = 80
          }

          resources {
            limits = {
              cpu    = "500m"
              memory = "512Mi"
            }
            requests = {
              cpu    = "250m"
              memory = "50Mi"
            }
          }
        }
      }
    }
  }
}

gRizzlyGR avatar Jan 13 '23 11:01 gRizzlyGR

I face the same issue. @gRizzlyGR I changed the resource limit and still it is showing the same error. Can any one please help me here? Thanks in advance.

reshmagcp avatar Jul 19 '23 13:07 reshmagcp

@reshmagcp or if anyone is still facing that issue, for me updating the value of nginx to an up-to-date image (for me it was 1.24.0) did work, when otherwise it wouldn't. I also changed the cpu value as suggested by @gRizzlyGR , but at first I still faced the issue. But referencing the up-to-date nginx image worked.

l1gh7w34ver avatar Mar 01 '24 23:03 l1gh7w34ver

Thanks a lot @gRizzlyGR @l1gh7w34ver , only applying both recommendationed works for me:

  1. updated CPU to 500m
  2. set nginx to 1.25.3

pkouzmitcheu avatar Mar 22 '24 18:03 pkouzmitcheu