Terraform kubeconfig issue
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Terraform kubeconfig issue

by
FaisalM
Created on 2022-02-19 11:35:09 (edited on 2024-09-04 14:26:12) in Public Cloud

After the cluster is created, I want to continue the deployment, but I cannot read the Kubeconfig file properly. How can i fix that inside me website? by the way, I connect my cluster with .kubeconfig file. But terraform cannot.
'config_path' refers to an invalid path: ".kubeconfig": stat .kubeconfig: no such file or directory

Error: Failed to create deployment: Post "http://localhost/apis/apps/v1/namespaces/default/deployments": dial tcp 127.0.0.1:80: connect: connection refused

deployment.tf

resource "kubernetes_deployment" "nginx_deployment" {
provider = kubernetes.kb
...
...
}
provider.tf

terraform {
required_providers {
ovh = {
source = "ovh/ovh"
version = "0.16.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.8.0"
}

local = {
source = "hashicorp/local"
version = "2.1.0"
}
}
}

# Configure the OVHcloud Provider
provider "ovh" {
endpoint = "ovh-ca"
application_key = ""
application_secret = ""
consumer_key = ""
}

provider "kubernetes" {
alias = "kb"
# load_config_file = "false"
config_path = ".kubeconfig"
}

provider "local" {
#comment
}

resource "local_file" "kubeconfig" {
content = ovh_cloud_project_kube.my_kube_cluster.kubeconfig
filename = ".kubeconfig"
}