Hostnames and kube context
Two commands set up your machine so the cluster is reachable by name.
/etc/hosts
$ xianyun update-etc-hosts --dry-run # show what would change
$ xianyun update-etc-hosts # write it
$ xianyun update-etc-hosts --remove # take the entries out again
Xianyun adds your configured hostname and additional_hostnames, pointing at the cluster’s IP. It only writes when a name is missing or points somewhere else. Writing needs sudo unless you’re root, and it replaces the whole file by piping the new content to sudo tee /etc/hosts.
Without --ip, the cluster’s address is detected, so the cluster has to be running. With --ip, the value is used as given. Pass an IP address and nothing else: the value isn’t validated, and a value containing a newline adds extra lines to the file. See TM-HOSTS-001.
Over MCP this tool is gated, including with dry_run set.
Kube context
$ xianyun set-kube-context --dry-run
$ xianyun set-kube-context --use # also make it the current context
$ xianyun set-kube-context --remove
This merges the project’s cluster into your kubeconfig ($KUBECONFIG or ~/.kube/config, or the file named by --kubeconfig), keeping everything else in it. It writes through a temporary file and renames it, and leaves a backup beside the original with a .caproni.bak suffix. The backup is mode 0644 even though the kubeconfig is 0600, which matters on shared machines. See TM-KUBE-001.
You don’t need this to work with the cluster. xianyun kubectl, xianyun k9s, and xianyun stern all point at the project’s cluster without touching your kubeconfig.