Skip to content

terraform destroy fails with local-exec error #102

@jubrad

Description

@jubrad

I suspect that this is just requires the correct context setup in the users kubectl, but it'd be nice if we didn't have that requirement, or documented it more clearly.

│ Error: local-exec provisioner error
│ 
│   with module.nodepool_materialize.terraform_data.destroyer,
│   on ../../modules/karpenter-nodepool/main.tf line 13, in resource "terraform_data" "destroyer":
│   13:   provisioner "local-exec" {
│ 
│ Error running command 'set -euo pipefail
│ nodeclaims=$(kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") get nodeclaims -l "karpenter.sh/nodepool=${NODEPOOL_NAME}" -o name)
│ if [ -n "${nodeclaims}" ]; then
│   echo "${nodeclaims}" | xargs kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") delete --wait=true
│ fi
│ ': exit status 1. Output: E1121 09:10:15.487856   52429 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1121 09:10:15.489593   52429 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1121 09:10:15.491149   52429 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1121 09:10:15.492858   52429 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ E1121 09:10:15.494659   52429 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
│ The connection to the server localhost:8080 was refused - did you specify the right host or port?
│ 
╵
╷
│ Error: local-exec provisioner error
│ 
│   with module.nodepool_generic.terraform_data.destroyer,
│   on ../../modules/karpenter-nodepool/main.tf line 13, in resource "terraform_data" "destroyer":
│   13:   provisioner "local-exec" {
│ 
│ Error running command 'set -euo pipefail
│ nodeclaims=$(kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") get nodeclaims -l "karpenter.sh/nodepool=${NODEPOOL_NAME}" -o name)
│ if [ -n "${nodeclaims}" ]; then
│   echo "${nodeclaims}" | xargs kubectl --kubeconfig <(echo "${KUBECONFIG_DATA}") delete --wait=true
│ fi
│

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions