Getting "cannot access cluster <name of the cluster> in namespace <name of the namespace>: the server could not find the requested resource" when trying to extract the Guest cluster support bundle using "vks-support-bundler".
search cancel

Getting "cannot access cluster <name of the cluster> in namespace <name of the namespace>: the server could not find the requested resource" when trying to extract the Guest cluster support bundle using "vks-support-bundler".

book

Article ID: 409119

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service

Issue/Introduction

  • When trying to export the TKGs cluster support bundle, you get the below error message.

    Unable to collect the support bundle successfully\nerror using Supervisor cluster kubeconfig: cannot access cluster <cluster-name> in namespace <namespace>: the server could not find the requested resource\n"

  • The command "kubectl vsphere login" was used to login to the concerned Guest cluster specifying the name of the guest cluster and the supervisor namespace where the concerned guest cluster is deployed. The basic syntax of the command can be found below.

    kubectl vsphere login --server=<vCenter server IP> --vsphere-username <user ID> --tanzu-kubernetes-cluster-name <name of the cluster> --tanzu-kubernetes-cluster-namespace <supervisor namespace where the guest cluster is deployed> --insecure-skip-tls-verify

Environment

vSphere Kubernetes Service

Cause

When a user runs the "kubectl vSphere login" command as mentioned in the introduction section, by default the current context is set to the Guest Cluster name. However, the VKS bundler expects you to be inside the context that gets created explicitly with the supervisor IP address. As a result, it cannot locate the cluster within the namespace specified.

Resolution

Switch to the supervisor IP Address context to extract the support bundle. Refer the below example on how to do the same.

  • For example, let's say the name of the cluster is "dummy-cluster" and the supervisor namespace where the cluster is deployed is "dummy-cluster-ns" . So the command to login to the guest cluster would be below.

    kubectl vsphere login --server=<vCenter server IP> --vsphere-username <user ID> --tanzu-kubernetes-cluster-name dummy-cluster --tanzu-kubernetes-cluster-namespace dummy-cluster-ns --insecure-skip-tls-verify

    Password:
    Logged in successfully.

    You have access to the following contexts:
       10.#.#.#        <------ This is the IP Address of the supervisor FIP. 
       dummy-cluster-ns
       dummy-cluster

  • Now to check the current context you're in, run the command "kubectl config get-context".  You'll notice that you're inside the namespace with the Guest cluster name itself. The current context is represented with an asterisk (*). Notice that there is a context. See below.

    []$ kubectl config get-contexts
    CURRENT   NAME                       CLUSTER           AUTHINFO                             NAMESPACE
                       10.#.#.#                     10.#.#.#                wcp:<IP>:<username>
                       dummy-cluster-ns      <IP-Address>      wcp:<IP>:<username>          dummy-cluster-ns
    *                 dummy-cluster            192.#.#.#             wcp:<IP>:<username>


  • To switch to the Supervisor IP namespace, use the command "kubectl config use-context <Supervisor IP namespace>". See below.

    [~]$ kubectl config use-context 10.#.#.#
    Switched to context "10.#.#.#".

  • Check the current context now and you should see it switched to the Supervisor IP Address namespace.

    [~]$ kubectl config get-context 
    CURRENT   NAME                        CLUSTER          AUTHINFO                            NAMESPACE
     *                  10.#.#.#                     10.#.#.#               wcp:<IP>:<username>
                        dummy-cluster-ns       <IP-Address>     wcp:<IP>:<username>         dummy-cluster-ns
                        dummy-cluster            192.#.#.#            wcp:<IP>:<username>

 

Now use the vks-support-bundler to extract the support bundle and you should be able to complete the same without issues.

 

 

Additional Information