nsc kubeconfig write
kubeconfig write generates a kubeconfig that allows connecting
kubectl to a cluster.
The config is written to a temporary file.
kubectl, the created kubeconfig can be selected by setting the
KUBECONFIG environment variable or by setting the
nsc kubeconfig write [cluster-id]
The following example shows how to generate a kubeconfig and use it to deploy an application into a cluster:
$ nsc create Created cluster "1lf2ol9ioulce" deadline: 2023-04-25T13:24:53Z $ nsc kubeconfig write 1lf2ol9ioulce Wrote Kubeconfig for cluster 1lf2ol9ioulce to ~/.cache/ns/tmp/kubeconfig/2342545987.yaml. Start using it by setting: export KUBECONFIG=~/.cache/ns/tmp/kubeconfig/2342545987.yaml $ export KUBECONFIG=~/.cache/ns/tmp/kubeconfig/2342545987.yaml $ kubectl apply -f https://k8s.io/examples/application/nginx-app.yaml service/my-nginx-svc created deployment.apps/my-nginx created
Write the config path to file. If file already exists, it will get overwritten.