kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

how to re-create vc1-kubeconfig file ? #169

Closed jichenjc closed 3 years ago

jichenjc commented 3 years ago

User Story

I was guide kubectl vc create -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-nested/master/virtualcluster/config/sampleswithspec/virtualcluster_1_nodeport.yaml -o vc-1.kubeconfig

to create vc-1.kubeconfig file , for whatever reason , the file is deleted, how can I recreate it from existing cluster? seems at least a doc is helpful here if the feature is already there

As a [developer/user/operator] I would like to [high level description] for [reasons]

Detailed Description

[A clear and concise description of what you want to happen.]

Anything else you would like to add:

[Miscellaneous information that will assist in solving the issue.]

/kind feature

christopherhein commented 3 years ago

The only way I know to do this currently is to look at the secrets in the control plane namespace and grab the admin-kubeconfig this then needs to be updated slightly to change the cluster.server and typically we disable insecure tls verify. With the move to CAPN this would be done w/ clusterctl.

jichenjc commented 3 years ago

I guess kubectl vc is something we can consider ? anyway, will dig more here

jichenjc commented 3 years ago

I figured out :)

use following command will help us in generating such kubeconfig file :), will update doc

$ sudo kubectl vc exec vc-sample-2
kubeconfig for virtualcluster default/vc-sample-2 is placed at:

        /home/cloudusr/.kube/vc/default-316569-vc-sample-2.kubeconfig

❗ You are now at VirtualCluster default/vc-sample-2
❗ use regular kubectl commands to operate vc in this temporary workspace
❗ type 'exit' to exit