rancher / terraform-provider-rke

Terraform provider plugin for deploy kubernetes cluster by RKE(Rancher Kubernetes Engine)
Mozilla Public License 2.0
340 stars 151 forks source link

Planning new nodes has no api_server_url #294

Open Robbilie opened 3 years ago

Robbilie commented 3 years ago

I am currently running a rke_cluster with a single node. I use the kubernetes provider like in the example: https://github.com/rancher/terraform-provider-rke/blob/master/examples/with_kubernetes_provider/example.tf

I use it for a namespace ressource:


# Kubernetes
resource "kubernetes_namespace" "flux_system" {
  metadata {
    name = "flux-system"
  }

  lifecycle {
    ignore_changes = [
      metadata[0].labels,
    ]
  }
}

Now when i add a second node to the rke_cluster, plan fails with the following error on the namespace:

Error: Get "http://localhost/api/v1/namespaces/flux-system": dial tcp 127.0.0.1:80: connect: connection refused

If i configure the kubernetes provider with a static host rather than the rke_cluster.cluster.api_server_url value it works fine.

rawmind0 commented 3 years ago

It seems for some reason rke_cluster.cluster.api_server_url is not being updated properly in your modules. Is your rke cluster listening at 127.0.0.1:80??

Robbilie commented 3 years ago

No, none of the described nodes has that up. Whenever I add a new node the property is not properly filled with the IP, if I temporarily hardcode it to the first nodes IP and then switch it back later to the api url it works fine...