Closed constding closed 4 years ago
Actually, was testing this provider today to evaluate some alternatives to kubectl. I had to downgrade to v0.6.0 to overcome this issue.
We cannot rollback to v0.6.0 as v0.7.0 introduced the full provider configuration to connect to the cluster...
More analysis: We hit it with a Service type ClusterIP and NodePort. In both cases the status was:
status:
loadBalancer: {}
... and never changes; but the service does work (via an ingress).
So it get stucks "pending" there: https://github.com/banzaicloud/terraform-provider-k8s/blob/v0.7.2/k8s/resource_k8s_manifest.go#L138-L144
terraform --version v0.12.20
terraform-provider-k8s version: v0.7.2
terraform file: https://github.com/banzaicloud/terraform-provider-k8s/blob/master/examples/0.12/example.tf
manifests: https://github.com/banzaicloud/terraform-provider-k8s/blob/master/examples/manifests/nginx-service.yaml
terraform apply data.template_file.nginx-service: Refreshing state...
An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
k8s_manifest.nginx-service will be created
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.
Enter a value: yes
k8s_manifest.nginx-service: Creating... k8s_manifest.nginx-service: Still creating... [10s elapsed] ... ... ... k8s_manifest.nginx-service: Still creating... [10m elapsed]
TF_LOG=TRACE terraform apply &> log
2020-02-14T16:26:48.951-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:48 [INFO] Creating new manifest: &unstructured.Unstructured{Object:map[string]interface {}{"apiVersion":"v1", "kind":"Service", "metadata":map[string]interface {}{"name":"nginx-service", "namespace":"default"}, "spec":map[string]interface {}{"ports":[]interface {}{map[string]interface {}{"name":"http", "port":80, "protocol":"TCP"}}, "selector":map[string]interface {}{"app":"nginx"}, "type":"LoadBalancer"}}} 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:48 [DEBUG] Kubernetes API Request Details: 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: ---[ REQUEST ]--------------------------------------- 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: POST /api/v1/namespaces/default/services HTTP/1.1 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: Host: 10.10.10.10:6443 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: User-Agent: HashiCorp/1.0 Terraform/0.12.20 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: Content-Length: 206 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: Accept: application/json 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: Accept-Encoding: gzip 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "apiVersion": "v1", 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "kind": "Service", 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "metadata": { 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "nginx-service", 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "namespace": "default" 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "spec": { 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "ports": [ 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "http", 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "port": 80, 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "protocol": "TCP" 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: ], 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "selector": { 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "app": "nginx" 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: "type": "LoadBalancer" 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:48.952-0600 [DEBUG] plugin.terraform-provider-k8s: ----------------------------------------------------- 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:48 [DEBUG] Kubernetes API Response Details: 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: ---[ RESPONSE ]-------------------------------------- 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: HTTP/2.0 201 Created 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: Content-Length: 531 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: Content-Type: application/json 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: Date: Fri, 14 Feb 2020 22:26:48 GMT 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "kind": "Service", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "apiVersion": "v1", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "metadata": { 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "nginx-service", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "namespace": "default", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "selfLink": "/api/v1/namespaces/default/services/nginx-service", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "uid": "a2b11f0f-120f-4671-b67b-8e313e482655", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "resourceVersion": "23132", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "creationTimestamp": "2020-02-14T22:26:48Z" 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "spec": { 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "ports": [ 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "http", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "protocol": "TCP", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "port": 80, 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "targetPort": 80, 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "nodePort": 32727 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: ], 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "selector": { 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "app": "nginx" 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "clusterIP": "172.16.10.18", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "type": "LoadBalancer", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "sessionAffinity": "None", 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: "externalTrafficPolicy": "Cluster" 2020-02-14T16:26:48.965-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: "status": { 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: "loadBalancer": {} 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: ----------------------------------------------------- 2020-02-14T16:26:48.966-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:48 [DEBUG] Waiting for state to become: [ready] 2020/02/14 16:26:53 [TRACE] dag/walk: vertex "provider.k8s (close)" is waiting for "k8s_manifest.nginx-service" 2020/02/14 16:26:53 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)" 2020/02/14 16:26:53 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "k8s_manifest.nginx-service" 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:53 [DEBUG] Kubernetes API Request Details: 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: ---[ REQUEST ]--------------------------------------- 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: GET /api/v1/namespaces/default/services/nginx-service HTTP/1.1 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: Host: 10.10.10.10:6443 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: User-Agent: HashiCorp/1.0 Terraform/0.12.20 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: Accept: application/json 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: Accept-Encoding: gzip 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:53.966-0600 [DEBUG] plugin.terraform-provider-k8s: ----------------------------------------------------- 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:53 [DEBUG] Kubernetes API Response Details: 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: ---[ RESPONSE ]-------------------------------------- 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: HTTP/2.0 200 OK 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: Content-Length: 531 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: Content-Type: application/json 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: Date: Fri, 14 Feb 2020 22:26:53 GMT 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "kind": "Service", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "apiVersion": "v1", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "metadata": { 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "nginx-service", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "namespace": "default", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "selfLink": "/api/v1/namespaces/default/services/nginx-service", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "uid": "a2b11f0f-120f-4671-b67b-8e313e482655", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "resourceVersion": "23132", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "creationTimestamp": "2020-02-14T22:26:48Z" 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "spec": { 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "ports": [ 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: { 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "name": "http", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "protocol": "TCP", 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "port": 80, 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "targetPort": 80, 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: "nodePort": 32727 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:53.970-0600 [DEBUG] plugin.terraform-provider-k8s: ], 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "selector": { 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "app": "nginx" 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "clusterIP": "172.16.10.18", 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "type": "LoadBalancer", 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "sessionAffinity": "None", 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "externalTrafficPolicy": "Cluster" 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: }, 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "status": { 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: "loadBalancer": {} 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: } 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: ----------------------------------------------------- 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:53 [DEBUG] Received object: &unstructured.Unstructured{Object:map[string]interface {}{"apiVersion":"v1", "kind":"Service", "metadata":map[string]interface {}{"creationTimestamp":"2020-02-14T22:26:48Z", "name":"nginx-service", "namespace":"default", "resourceVersion":"23132", "selfLink":"/api/v1/namespaces/default/services/nginx-service", "uid":"a2b11f0f-120f-4671-b67b-8e313e482655"}, "spec":map[string]interface {}{"clusterIP":"172.10.10.10", "externalTrafficPolicy":"Cluster", "ports":[]interface {}{map[string]interface {}{"name":"http", "nodePort":32727, "port":80, "protocol":"TCP", "targetPort":80}}, "selector":map[string]interface {}{"app":"nginx"}, "sessionAffinity":"None", "type":"LoadBalancer"}, "status":map[string]interface {}{"loadBalancer":map[string]interface {}{}}}} 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:53 [DEBUG] Object has status: map[string]interface {}{"loadBalancer":map[string]interface {}{}} 2020-02-14T16:26:53.971-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:26:53 [TRACE] Waiting 5s before next try 2020/02/14 16:26:58 [TRACE] dag/walk: vertex "provider.k8s (close)" is waiting for "k8s_manifest.nginx-service" 2020/02/14 16:26:58 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)" 2020/02/14 16:26:58 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "k8s_manifest.nginx-service" [0m[1mk8s_manifest.nginx-service: Still creating... [10s elapsed][0m[0m
... ... ...
2020-02-14T16:30:49.094-0600 [DEBUG] plugin.terraform-provider-k8s: 2020/02/14 16:30:49 [TRACE] Waiting 10s before next try 2020/02/14 16:30:53 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)" 2020/02/14 16:30:53 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "k8s_manifest.nginx-service" 2020/02/14 16:30:53 [TRACE] dag/walk: vertex "provider.k8s (close)" is waiting for "k8s_manifest.nginx-service" 2020/02/14 16:30:58 [TRACE] dag/walk: vertex "root" is waiting for "meta.count-boundary (EachMode fixup)" 2020/02/14 16:30:58 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "k8s_manifest.nginx-service" 2020/02/14 16:30:58 [TRACE] dag/walk: vertex "provider.k8s (close)" is waiting for "k8s_manifest.nginx-service" [0m[1mk8s_manifest.nginx-service: Still creating... [4m10s elapsed][0m[0m