Prints the path of the instance's kubeconfig, fetching it over ssh for hosts
Synopsis
Prints the path of the kubeconfig of an instance (default: the targeted one).
- k8srun: the kubeconfig stored when the cluster was created.
- host: fetched once over ssh from k3s on the host ('k3s kubectl config view --raw', needs sudo), with the server address changed from 127.0.0.1 to the instance's host, and stored in ~/.nova/instances/<name>/kubeconfig (mode 0600). Use --refresh to fetch it again. The ssh user is remembered for the instance. If you already have the kubeconfig (e.g. a copy of /etc/rancher/k3s/k3s.yaml from the device), pass it with --kubeconfig <file> (or '-' for stdin) instead: no ssh is needed; a copy is stored the same way, with a 127.0.0.1 server pointed to the host.
- cloud: not available.
Only the path is printed, never the content. The kubeconfig grants admin access to the instance's Kubernetes cluster: don't hand it to an agent working unattended on an instance that drives real robots.
Without a TTY, sudo can't prompt for a password. Run once with --setup-ssh-key to install your ssh key and a k3s-only passwordless sudo rule (the same as 'nova app install --setup-ssh-key'), or use --no-sudo when logging in as root.
nova instance kubeconfig [name] [flags]
Examples
# fetch it over ssh
$ nova instance kubeconfig lab --ssh-user admin --setup-ssh-key
# or use a kubeconfig you already have
$ nova instance kubeconfig lab --kubeconfig ./k3s.yaml
$ kubectl --kubeconfig "$(nova instance kubeconfig lab)" get pods -A
# or set KUBECONFIG and NOVA_INSTANCE for this shell
$ eval "$(nova instance env lab)"
Options
-h, --help help for kubeconfig
--kubeconfig string Use this kubeconfig file ('-' for stdin) instead of fetching it over ssh; a copy is stored for the instance.
--no-sudo Read the kubeconfig without sudo (e.g. when connecting as root).
-o, --output format Output format: text or json (default text)
--refresh Fetch the kubeconfig of a host instance again.
--setup-ssh-key Before fetching, install your SSH public key and (unless --no-sudo) a passwordless sudo rule for k3s on the host. Needs the SSH and one sudo password once.
--ssh-port int SSH port. If 0, your ssh config or the default applies.
--ssh-user string SSH user for fetching the kubeconfig of a host instance (remembered for the instance). If empty, the remembered user, your ssh config or the current user applies.
Options inherited from parent commands
--debug Write diagnostic output to stderr: HTTP requests and responses, external commands, the resolved instance. Known secrets are redacted, but bodies (app environments, kubeconfigs) can still contain some: don't share the output unreviewed (env: NOVA_DEBUG=1)
--env string (Wandelbots internal) Portal environment for this invocation: prod, stg or dev (default: the environment of the cloud instance, else of the last 'nova login'; env: NOVA_ENV)
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity (disables TLS verification for all requests)
--instance string Name of the instance to work against for this invocation (overrides the selected instance; env: NOVA_INSTANCE)
SEE ALSO
- nova instance - Manage the NOVA instances the CLI works against