Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Enhance the error message when an admin.kubeconfig already exists, but is corrupt #2295

Closed
apoorvajagtap opened this issue Nov 2, 2022 · 2 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.

Comments

@apoorvajagtap
Copy link
Contributor

Describe the bug

Recently I was performing a kcp startup, which failed with the following errors:

cannot create the 'admin.kubeconfig` file with an empty token for the shard-admin user

Later, I determined the issue was due to a pre-existing corrupt kubeconfig (did not have any token or context details for shard-admin user) at .kcp/admin.kubeconfig. After cleaning up .kcp, I re-ran go run ./cmd/kcp start, and it progressed well!

Would it be feasible to enhance the error message, when the admin.kubeconfig file already exists but does not have token details of the shard-admin user, rather than just stating that "it couldn't be created with empty token"? Let me know your thoughts!

If this seems like a useful change, I would like to work on it. Thanks!

Steps To Reproduce

  1. Remove the context and token details for shard-admin user in the .kcp/admin.kubeconfig.
  2. Build and start the kcp: go run ./cmd/kcp start

Expected Behaviour

A clearer message that indicates the missing context & token details from the existing kubeconfig.

Additional Context

No response

@apoorvajagtap apoorvajagtap added the kind/bug Categorizes issue or PR as related to a bug. label Nov 2, 2022
@ncdc ncdc added this to kcp Nov 2, 2022
@ncdc ncdc moved this to New in kcp Nov 2, 2022
@ncdc ncdc moved this from New to Backlog in kcp Nov 8, 2022
@mjudeikis
Copy link
Contributor

using kcp-dev/helm-chart

Error: cannot create the 'admin.kubeconfig' file with an empty token for the shard-admin user

in the kcp volume:

ls -la
total 8
drwxrwxrwx. 1 root  root    48 Feb 14 10:49 .
drwxr-xr-x. 1 root  root   462 Feb 14 10:49 ..
-rw-------. 1 65532 65532   32 Feb 14 10:49 .admin-token-store
-rw-------. 1 65532 65532 3243 Feb 14 10:49 sa.key
root@kcp-control-plane:/var/local-path-provisioner/pvc-cd809aff-299a-4a58-b7a2-350a460aff52_kcp_kcp# cat .admin-token-store 
LYk.bezB4x'x&>j

after deleting the .admin-token-store and restart it worked 🤷

cat .admin-token-store                                                                                                                                                                                                                                                                                                     
qB!EKv0rr

@MikeSpreitzer
Copy link
Contributor

Isn't the corruption of .admin-token-store itself a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
Status: Done
Development

No branches or pull requests

3 participants