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

failed to create kubernetes rest client for read of resource #229

Open
bitsofinfo opened this issue Nov 18, 2022 · 3 comments
Open

failed to create kubernetes rest client for read of resource #229

bitsofinfo opened this issue Nov 18, 2022 · 3 comments

Comments

@bitsofinfo
Copy link

    kubectl = {
      source  = "gavinbunney/kubectl"
      version = ">= 1.14.0"
    }

....

provider "kubectl" {
  config_path      = local_file.kube_config.filename
  config_context   = var.kube_config_context
  load_config_file = false
}

Constantly get

Error: failed to create kubernetes rest client for read of resource: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused

This seems to only happen on destroy

I've tried both load_config_file = true / false to no avail (the option is confusing... what "path" does this pertain to? the default one on the system or the one in config_path?) is this mutually exclusive or not when used in combination with config_path?)

@bmitchinson
Copy link

Getting this on apply as well. Doing research to see if it's related to https://support.hashicorp.com/hc/en-us/articles/4408936406803-Kubernetes-Provider-block-fails-with-connect-connection-refused-

I don't think though since the initial apply works fine and creates resources, just the state refresh fails 🤔

@thiagoscodelerae
Copy link

Getting the same issue here. It works normally and after some time it starting retrieving the same issue reported by @bitsofinfo

provider "kubectl" {
  apply_retry_count      = 5
  host                   = aws_eks_cluster.this.endpoint
  cluster_ca_certificate = base64decode(aws_eks_cluster.this.certificate_authority[0].data)
  load_config_file       = false

  exec {
    api_version = "client.authentication.k8s.io/v1beta1"
    args        = ["eks", "get-token", "--cluster-name", aws_eks_cluster.this.id]
    command     = "aws"
  }
}
    kubectl = {
      source  = "gavinbunney/kubectl"
      version = "~> 1.14"
    }

@romancherednikovopsfleet

I'v switch to this provider - https://registry.terraform.io/providers/alekc/kubectl/latest/docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants