Skip to content

Instantly share code, notes, and snippets.

@ntnn
Created February 24, 2026 23:28
Show Gist options
  • Select an option

  • Save ntnn/659d0a421c8200c46c17562acd590c97 to your computer and use it in GitHub Desktop.

Select an option

Save ntnn/659d0a421c8200c46c17562acd590c97 to your computer and use it in GitHub Desktop.
kset .kcp/admin.kubeconfig
k ws tree
k create-workspace --enter one
k create-workspace --enter two
k create sa sa-in-two
token="$(k create token sa-in-two)"
kcp_url="$(k config view --minify -o jsonpath='{.clusters[0].cluster.server}')"
k get configmaps kube-root-ca.crt -o jsonpath='{.data.ca\.crt}' > ca.crt
k --kubeconfig sa.kubeconfig config set-cluster sa-cluster --server="$kcp_url" --certificate-authority=ca.crt --embed-certs=true
k --kubeconfig sa.kubeconfig config set-credentials sa-user --token="$token"
k --kubeconfig sa.kubeconfig config set-context sa-context --cluster=sa-cluster --user=sa-user
k --kubeconfig sa.kubeconfig config use-context sa-context
KUBECONFIG=sa.kubeconfig k ws tree
KUBECONFIG=sa.kubeconfig k ws :root
KUBECONFIG=sa.kubeconfig k ws tree
KUBECONFIG=sa.kubeconfig k ws :root:one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment