aws / aws/eks-anywhere

Cannot delete the mgmt cluster when kubeconfig file is not in the conventional location

Open
#3,126 0 comments 0 reactions 0 assignees View on GitHub
area/cli kind/bug team/cli
Dominant language
Go
Stars
2.1k
Forks
328
Avg merge
1d 4h
Merged PRs (30d)
9

Description

**What happened**:

When the mgmt cluster's kubeconfig file is not in the conventional location ([cluster_name]/[cluster_name]-eks-a-ckuster.kubeconfig) deleting the cluster isn't working. I specified the kubeconfig path in two ways.

1. --kubeconfig parameter
```
+ eksctl anywhere delete cluster -f ./cluster/cluster.yaml --kubeconfig ./rbxop-cs-dev-isc-mgmt-wk.kubeconfig -v 10 --bundles-override /home/devo/c8842531/rbxop-cluster-rbxop-cs-dev-isc-mgmt/manifest.yaml
2022-08-22T23:06:31.056Z V4 Logger init completed {"vlevel": 10}
2022-08-22T23:06:31.056Z V6 Executing command {"cmd": "/usr/bin/docker version --format {{.Client.Version}}"}
2022-08-22T23:06:31.115Z V6 Executing command {"cmd": "/usr/bin/docker info --format '{{json .MemTotal}}'"}
2022-08-22T23:06:31.291Z V1 RegistryMirrorConfiguration.Port is not specified, default port will be used {"Default Port": "443"}
2022-08-22T23:06:31.291Z V0 Warning: The recommended number of control plane nodes is 3 or 5
Error: kubeconfig file missing: path=rbxop-cs-dev-isc-mgmt-wk/rbxop-cs-dev-isc-mgmt-wk-eks-a-cluster.kubeconfig
```

2. -w parameter
```
eksctl anywhere delete cluster -f ./cluster/cluster.yaml -w ./rbxop-cs-dev-isc-mgmt-wk.kubeconfig
```

```
2022-08-23T02:51:51.355Z
V6 Executing command
{"cmd": "/usr/bin/docker exec -i eksa_1661222941068959621 kubectl get machines -o json --kubeconfig rbxop-cs-dev-isc-mgmt-wk/rbxop-cs-dev-isc-mgmt-wk-eks-a-cluster.kubeconfig --selector=cluster.x-k8s.io/cluster-name=rbxop-cs-dev-isc-mgmt-wk --namespace eksa-system"}
2022-08-23T02:51:51.523Z
V9 docker
{"stderr": "error: stat rbxop-cs-dev-isc-mgmt-wk/rbxop-cs-dev-isc-mgmt-wk-eks-a-cluster.kubeconfig: no such file or directory\n"}
2022-08-23T02:51:51.523Z
V5 Error happened during retry
{"error": "getting machines resources from management cluster: getting machines: error: stat rbxop-cs-dev-isc-mgmt-wk/rbxop-cs-dev-isc-mgmt-wk-eks-a-cluster.kubeconfig: no such file or directory\n", "retries": 1}
```

**What you expected to happen**:

Deleting a mgmt cluster should work with the kubeconfig file in a custom path.

**How to reproduce it (as minimally and precisely as possible)**:

1. Create a mgmt cluster
2. Move the kubeconfig file to a different location
3. Try to delete the cluster with -w or --kubeconfig

**Anything else we need to know?**:

**Environment**:
- EKS Anywhere Release: 0.11.0
- EKS Distro Release:

Contributor guide

Open the contributing guide

Research direction

Start with the `eksctl anywhere delete cluster` entry point and compare how `--kubeconfig` and `-w` are handled when the management-cluster kubeconfig has been moved. Reproduce the failure using the minimal three-step sequence in the report and verify that deletion succeeds with a custom kubeconfig path.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, go
Domain
cli, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.