cat /root/.kube/config > default_kubeconfig
Unable to connect, system has encountered a connectivity issue due to the expiry of Kubernetes Configuration. Update the Kubernetes Configuration to resolve.
You must be logged in to the server. (Unauthorized)
To resolve this issue, the vSphere Supervisor Workload cluster token for the NAPP account needs to be recreated for renewal and associated with a serviceaccount so that it does not expire.
The below steps assume access to the Supervisor cluster as root and access to one of the NSX managers to run napp-k config view commands.
It is also assumed that the NSX manager has the previous kubeconfig with the expired token for the desired account NAPP uses to communicate with vSphere Supervisor.
These steps will advise on creating a serviceaccount with cluster-admin role for the NAPP account, generating the token and replacing the expired token in the NSX manager's kubeconfig with the renewed token.
napp-k config view -ojsonpath='{.users}'
[{"name":"wcp:<cluster VIP address>:<nappuser>@vsphere.local"
kubectl create serviceaccount <nappuser> -n kube-system
kubectl create clusterrolebinding <nappuser> --serviceaccount=kube-system:<nappuser> --clusterrole=cluster-admin
vi <nappuser>token.yaml
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: <nappuser>
namespace: kube-system
annotations:
kubernetes.io/service-account.name: "<nappuser>"
kubectl apply -f <nappuser>token.yaml
kubectl get secret <nappuser> -n kube-system -ojsonpath='{.data.token}' | base64 -d
alias napp-k
alias napp-k 'kubectl --config=<kubeconfig directory>/.kube/config -n nsxi-platform'
cp <kubeconfig directory>/.kube/config <nappuser>-kubeconfig-backup
vi <kubeconfig directory>/.kube/config
users:
- name: wcp:<cluster VIP>:<nappuser>@vsphere.local
user:
token: <token>
- name: wcp:<cluster VIP>:<nappuser>@vsphere.local
user:
token: <token>
napp-k get pods
Otherwise, check that the previous steps were performed properly for the correct NAPP user.
cat <kubeconfig directory/.kube/config
Upload the newly generated kubeconfig file with a non-expiring token to the NSX Application Platform.
a. On the NSX UI Home page, navigate to System > NSX Application Platform.
b. From the Actions drop-down menu, select Settings.
c. In the Configuration section, click the EDIT link.
d. In the Upload File field, click SELECT, select the newly generated config file with a non-expiry token, click Open, and click Upload.
e. Ensure that the file is successfully uploaded and click NEXT.
f. Click the RUN PRECHECKS button, to ensure the environment still satisfies all the NSX Application Platform deployment requirements.
g. Click NEXT to continue.
h. Click CLOSE.
However, you will need to generate a valid (not expired token) every time you want to: