Download and use kubeconfig for a MLOps Studio namespace
This guide explains how to download kubeconfig for a MLOps Studio namespace, configure kubectl on your local machine, and verify command-line access.
Kubeconfig is required when you need to work with Kubernetes resources directly from the command line. Use it to inspect pods, services, logs, PVCs, and other namespace resources, or to prepare workloads that must be submitted with kubectl.
The MLOps Platform provides access to namespaces through the web interface, but some workflows are easier or only possible from a local terminal. After downloading kubeconfig, configure kubectl locally and verify that you can access the correct namespace.
Prerequisites
Before starting, make sure that the following requirements are met.
No. 1 Access to the MLOps Studio workspace
You can sign in to the MLOps Platform and open your workspace.
See Access the MLOps Studio workspace.
No. 2 Existing namespace
A namespace has already been created.
See Create and manage a MLOps Studio namespace.
No. 3 Permission to download kubeconfig
Your account has permission to download kubeconfig for the namespace.
No. 4 kubectl installed locally
You need kubectl installed on your local machine.
No. 5 Terminal access
You need access to a local terminal where you can set environment variables and run kubectl commands.
Download kubeconfig
Open your workspace and find the namespace that you want to access from the command line.
Use the namespace actions menu – click on three dots to the right end of the window – to download the kubeconfig file.
Save the file to a safe location on your local machine.
Note
The kubeconfig file provides access to your namespace. Do not share it publicly or commit it to a source code repository.
If you are not a member of the namespace, the error 403 will appear:
Set KUBECONFIG
After downloading the file, configure your terminal session to use it.
On Linux or macOS, run:
export KUBECONFIG=/path/to/your/kubeconfig.yaml
Replace /path/to/your/kubeconfig.yaml with the actual path to the downloaded file.
On Windows PowerShell, run:
$env:KUBECONFIG="C:\path\to\your\kubeconfig.yaml"
Verify namespace access
Verify that kubectl can connect to the cluster:
kubectl get namespaces
Then verify that you can list resources in your namespace:
kubectl get pods -n <your-namespace>
Replace <your-namespace> with the name of your namespace.
Use kubectl with the namespace
When running commands, specify your namespace explicitly:
kubectl get pods -n <your-namespace>
kubectl get services -n <your-namespace>
kubectl get pvc -n <your-namespace>
You can also set the namespace as the default for the current context:
kubectl config set-context --current --namespace=<your-namespace>
After that, you can run commands without adding -n <your-namespace> each time:
kubectl get pods
kubectl get services
kubectl get pvc
Use Kubernetes from Visual Studio Code
You can also use the cluster from Visual Studio Code by installing the Kubernetes extension and providing your kubeconfig file.
For the required extension, see:
What to do next
After configuring kubeconfig, you can use kubectl for workflows that require command-line access, such as port forwarding, creating ConfigMaps, creating PVCs, and running Kubernetes-based jobs.