khuedoan / homelab

Fully automated homelab from empty disk to running services with a single command.
https://homelab.khuedoan.com
GNU General Public License v3.0
8.24k stars 765 forks source link

Error: Post "http://localhost/api/v1/namespaces/cloudflared/secrets": dial tcp [::1]:80: connect: connection refused #166

Closed Agilitytime closed 3 days ago

Agilitytime commented 2 months ago

Describe the bug

Cloudflare is not Working

To reproduce

Steps to reproduce the behavior:

I Create the Cluster with Make, also after an Redeploy i have this error. Can somebody help me?

Thanks!

Expected behavior

module.cloudflare.kubernetes_secret.cert_manager_token: Creating... ╷ │ Error: Post "http://localhost/api/v1/namespaces/cloudflared/secrets": dial tcp [::1]:80: connect: connection refused │ │ with module.cloudflare.kubernetes_secret.cloudflared_credentials, │ on modules/cloudflare/main.tf line 28, in resource "kubernetes_secret" "cloudflared_credentials": │ 28: resource "kubernetes_secret" "cloudflared_credentials" { │ ╵ ╷ │ Error: Post "http://localhost/api/v1/namespaces/external-dns/secrets": dial tcp [::1]:80: connect: connection refused │ │ with module.cloudflare.kubernetes_secret.external_dns_token, │ on modules/cloudflare/main.tf line 62, in resource "kubernetes_secret" "external_dns_token": │ 62: resource "kubernetes_secret" "external_dns_token" { │ ╵ ╷ │ Error: Post "http://localhost/api/v1/namespaces/cert-manager/secrets": dial tcp [::1]:80: connect: connection refused │ │ with module.cloudflare.kubernetes_secret.cert_manager_token, │ on modules/cloudflare/main.tf line 91, in resource "kubernetes_secret" "cert_manager_token": │ 91: resource "kubernetes_secret" "cert_manager_token" { │ ╵ ╷ │ Error: Post "http://localhost/api/v1/namespaces/global-secrets/secrets": dial tcp [::1]:80: connect: connection refused │ │ with module.extra_secrets.kubernetes_secret.external, │ on modules/extra-secrets/main.tf line 1, in resource "kubernetes_secret" "external": │ 1: resource "kubernetes_secret" "external" { │ ╵ ╷ │ Error: Post "http://localhost/api/v1/namespaces/monitoring-system/secrets": dial tcp [::1]:80: connect: connection refused │ │ with module.ntfy.kubernetes_secret.ntfy_auth, │ on modules/ntfy/main.tf line 1, in resource "kubernetes_secret" "ntfy_auth": │ 1: resource "kubernetes_secret" "ntfy_auth" { │ ╵ Operation failed: failed running terraform apply (exit 1)

aschampion commented 1 month ago

Terraform can't load your kubeconfig and therefore is using the default, which is localhost. Most likely this is because the execution context for your terraform workspace wasn't changed to "local" as instructed in step 3 of the docs.

khuedoan commented 3 days ago

Thanks @aschampion for supporting this, that looks like the root cause and I think we can close the issue.

Please reopen if it still doesn't work after you change the execution mode to local.