Skip to main content
Version: main 🚧

Get kubeconfig File

Platform-managed namespaces are deprecated

Namespaces managed through projects, also known as spaces, are deprecated in v5.0.0. Platform management of namespaces is planned for removal in a later v5.0 patch release. Existing Kubernetes namespaces and their workloads will remain on their clusters after removal. The platform will no longer manage them.

Until then, platform-managed namespaces keep working in projects outside tenants. Tenant projects can't create or import them, and they can't be moved into a tenant project. Move workloads that need continued platform management to clusters.

You can either manually construct a kubeconfig to access your namespace or use the vCluster CLI to automatically create a kubeconfig.

Retrieve using the CLI​

You can update your current kube-config by running the following command:

vcluster platform connect namespace my-namespace --project my-project

If you want to print the kubeconfig, you can append --print to the command:

vcluster platform connect namespace my-namespace --project my-project --print
info

Depending on if you have regional cluster endpoints enabled, the kubeconfig will look different.

See the Platform CLI hub for UI-to-CLI equivalents across common Platform tasks, including namespace commands.

kubeconfig without CLI​

You can create the kubeconfig also manually by creating an access key for your user first and then using the following template, with the following placeholders:

  • $PROJECT: the project the namespace is in
  • $SPACE: the space name to connect to
  • $NAMESPACE: the target namespace (check the spec.clusterRef.namespace field in the SpaceInstance object)
  • $PLATFORM_URL: the platform host you connect to
  • $ACCESS_KEY: the access key to use

Then replace these placeholders in the following template and save it as my-kubeconfig.yaml:

apiVersion: v1
kind: Config
clusters:
- cluster:
server: https://$PLATFORM_URL/kubernetes/project/$PROJECT/space/$SPACE
# Optional: if the server uses an insecure certificate
# insecure-skip-tls-verify: true
name: loft
contexts:
- context:
cluster: loft
namespace: $NAMESPACE
user: loft
name: loft
current-context: loft
users:
- name: loft
user:
token: $ACCESS_KEY

Access your namespace with:

KUBECONFIG=my-kubeconfig.yaml kubectl get pods