Open flashpixx opened 2 years ago
I have no idea if this is helpful or not, but this is our provider declaration:
provider "kubectl" {
host = module.aks_cluster.kube_config.host
client_certificate = base64decode(module.aks_cluster.kube_config.client_certificate)
client_key = base64decode(module.aks_cluster.kube_config.client_key)
cluster_ca_certificate = base64decode(module.aks_cluster.kube_config.cluster_ca_certificate)
load_config_file = false
}
Is client_key
required?
I'm getting the same error, with different reason:
Error: dev/hix-bg failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp 127.0.0.1:80: connect: connection refused
I'm getting the same error, with different reason:
Error: dev/hix-bg failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp 127.0.0.1:80: connect: connection refused
Is your host
supposed to be localhost
? If not, is it set in the provider
config? Finally, did you set load_config_file = false
?
Yes, setting load_config_file = false
solved this.
facing same issue and load_config_file = false this already in place but still getting error like below
Error: wasmplugins.extensions.istio.io failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused 2023-04-14T02:41:32.9556305Z 2023-04-14T02:41:32.9556673Z with module.central_region.module.istio_dsy.kubectl_manifest.istio_crds["/apis/apiextensions.k8s.io/v1/customresourcedefinitions/wasmplugins.extensions.istio.io"], 2023-04-14T02:41:32.9557292Z on .terraform/modules/central_region.istio_dsy/istio/base/istio.tf line 9, in resource "kubectl_manifest" "istio_crds": 2023-04-14T02:41:32.9557593Z 9: resource "kubectl_manifest" "istio_crds" { 2023-04-14T02:41:32.9557650Z 2023-04-14T02:41:32.9561037Z 2023-04-14T02:41:32.9562726Z Error: telemetries.telemetry.istio.io failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused 2023-04-14T02:41:32.9562882Z 2023-04-14T02:41:32.9563224Z with module.central_region.module.istio_dsy.kubectl_manifest.istio_crds["/apis/apiextensions.k8s.io/v1/customresourcedefinitions/telemetries.telemetry.istio.io"], 2023-04-14T02:41:32.9563455Z on .terraform/modules/central_region.istio_dsy/istio/base/istio.tf line 9, in resource "kubectl_manifest" "istio_crds": 2023-04-14T02:41:32.9563672Z 9: resource "kubectl_manifest" "istio_crds" { 2023-04-14T02:41:32.9563728Z 2023-04-14T02:41:32.9566926Z 2023-04-14T02:41:32.9567789Z Error: peerauthentications.security.istio.io failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused 2023-04-14T02:41:32.9569034Z 2023-04-14T02:41:32.9569671Z with module.central_region.module.istio_dsy.kubectl_manifest.istio_crds["/apis/apiextensions.k8s.io/v1/customresourcedefinitions/peerauthentications.security.istio.io"], 2023-04-14T02:41:32.9570140Z on .terraform/modules/central_region.istio_dsy/istio/base/istio.tf line 9, in resource "kubectl_manifest" "istio_crds": 2023-04-14T02:41:32.9570496Z 9: resource "kubectl_manifest" "istio_crds" {
I had same issue of @flashpixx and I found a solution, even if I'm not 100% sure on cause, I'll try to explain.
I had this config for kind provider:
resource "kind_cluster" "main_cluster" {
name = var.main_cluster_name
kubeconfig_path = pathexpand(var.kubernetes_config_file)
}
and this one:
provider "kubectl" {
load_config_file = true
config_path = pathexpand(var.kubernetes_config_file)
}
After failing I applied again with the already existing kind cluster (and config file ofc), it worked.
So after some tests I changed config to this:
provider "kubectl" {
load_config_file = true
config_path = kind_cluster.main_cluster.kubeconfig_path
}
and it worked from scratch; for some reason, declaring the config file to use as a variable and not as output by kind provider was the problem.
Just for the records, these are my versions:
terraform {
required_providers {
kind = {
source = "tehcyx/kind"
version = "~> 0.0.17"
}
http = {
source = "hashicorp/http"
version = "~> 3.3.0"
}
kubectl = {
source = "gavinbunney/kubectl"
version = "~> 1.14.0"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.9.0"
}
}
required_version = "~> 1.4.0"
}
For more info, the repo I'm working on is: https://github.com/valeriano-manassero/kubernetes-gitops-dev
Hello,
I try to deploy the ingress file https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml with the provider in this structure (this script below is a minimal example which can be executed)
I get on a
terraform apply
the error logHow can I fix this? A normal command-line call with
kubectl -f https://..
works fine and produces a valid output / configuration