Configure cluster CLI access
Run the examples from the repository root. Kubernetes and Talos use separate client configurations; access to one does not automatically grant access to the other.
Kubernetes
The Talos OpenTofu stack writes kubeconfig at the repository root. Use it explicitly:
/home/linuxbrew/.linuxbrew/bin/kubectl --kubeconfig kubeconfig get nodes -o wideFor a sequence of commands in the same Bash session, a function preserves argument boundaries:
k() { /home/linuxbrew/.linuxbrew/bin/kubectl --kubeconfig kubeconfig "$@"}
k get namespacesAvoid storing an executable plus arguments in one quoted string and relying on word splitting. These guides retain the full command where a snippet should work on its own.
Talos client configuration
Prefer a recovered talosconfig from your protected administration backup. When only local OpenTofu state is available, extract its client configuration into a restricted file. This example uses the existing talos_machine_secrets resource and the repository’s three control-plane addresses; adjust the addresses for your fork.
python3 - <<'PYTHON'import jsonimport osfrom pathlib import Path
os.umask(0o077)state = json.loads(Path( "infrastructure/opentofu/talostofu/terraform.tfstate").read_text())resource = next( item for item in state["resources"] if item["type"] == "talos_machine_secrets")client = resource["instances"][0]["attributes"]["client_configuration"]if isinstance(client, list): client = client[0]
content = "\n".join([ "context: antalos", "contexts:", " antalos:", " endpoints:", " - 10.30.0.6", " - 10.30.0.7", " - 10.30.0.8", " nodes:", " - 10.30.0.6", " ca: " + client["ca_certificate"], " crt: " + client["client_certificate"], " key: " + client["client_key"], "",])output = Path("talosconfig")output.touch(mode=0o600, exist_ok=True)output.chmod(0o600)output.write_text(content)PYTHONThis reads sensitive local state without printing it and writes block-style YAML using spaces. If your state uses a remote backend or a different resource structure, use the provider’s supported output/export procedure and protect the resulting file to the same standard.
Use Talos explicitly
talosctl --talosconfig talosconfig --nodes 10.30.0.6 get membersReplace the node address with an endpoint from your actual topology. Prefer explicit flags in runbooks so a stale environment variable cannot silently select another cluster.
Recover access separately from application passwords
Kubeconfig and talosconfig are administrative credentials. Application passwords are stored in their own named Secrets and should be retrieved privately only when needed. None of the inspection commands above requires printing a Secret value.
