kubectl Access
Use the PW CLI to authenticate with Kubernetes clusters managed by Parallel Works. The CLI handles kubeconfig generation, certificate management, and OIDC token-based authentication so you can use kubectl against your clusters without manual configuration.
Prerequisites
- The PW CLI installed and configured
kubectlinstalled on your local machine- Access to at least one Kubernetes cluster in your organization
Listing Available Clusters
To see which Kubernetes clusters you have access to, run:
pw kube lsThis lists all clusters available in your organization. You can control the output format:
# Output as JSON
pw kube ls -o json
# Output as a table (shows name, total vCPUs, total memory)
pw kube ls -o tableQuick Overview
Use pw kube ls -o table for a quick overview of cluster capacity.
Authenticating with a Cluster
The pw kube auth command configures your local kubeconfig with everything needed to connect to a cluster:
pw kube auth <cluster-name>For example, to set up access to a cluster named demo:
pw kube auth demoThis command performs the following steps automatically:
- Retrieves the cluster's CA certificate and API server endpoint from the platform
- Adds or updates a cluster entry in your kubeconfig with the CA certificate embedded
- Configures user credentials using the OIDC exec-credential plugin (calls
pw kube tokenautomatically whenkubectlneeds a token) - Creates a context named
pw#<cluster-name>and switches to it
After running pw kube auth, you can immediately use kubectl:
kubectl get namespaces
kubectl get pods -n <namespace>Options
| Flag | Description |
|---|---|
--no-context-switch | Configure the cluster without switching your active kubectl context |
Context Naming
The context is named pw#<cluster-name>. You can switch between contexts with kubectl config use-context pw#<cluster-name>.
Manual Token Generation
If you need a raw OIDC token (for example, to use with a custom tool or API client), use:
pw kube token <cluster-name>This outputs an ExecCredential JSON object compatible with the Kubernetes client-go credential plugin protocol:
{
"apiVersion": "client.authentication.k8s.io/v1",
"kind": "ExecCredential",
"status": {
"token": "<oidc-token>"
}
}Token Expiry
Tokens expire after 10 minutes. The exec-credential plugin handles renewal automatically when you use pw kube auth, but if you use tokens manually you will need to regenerate them before they expire.
How Authentication Works
Parallel Works uses OIDC (OpenID Connect) tokens to authenticate users with Kubernetes clusters. Here is how the flow works:
- When you run
pw kube auth <cluster-name>, the CLI configures kubectl to usepw kube token <cluster-name>as an exec-based credential plugin. - Each time
kubectlmakes a request, it invokespw kube tokento obtain a fresh OIDC token. - The Kubernetes API server validates the token against the platform's OIDC provider.
Token Claims
Each OIDC token contains the following claims:
| Claim | Value |
|---|---|
sub (subject) | user:<username> |
aud (audience) | The cluster ID |
iss (issuer) | https://<platform-host>/api/oidc |
groups | List of group names the user belongs to, plus cluster-scope |
platform_host | The platform hostname |
exp (expiry) | 10 minutes from issuance |
Namespace Access
Access to namespaces is determined by your group memberships:
- Each group that has been granted access to a cluster gets a corresponding namespace (named after the group).
- You can access namespaces for any group you belong to that is shared with the cluster.
- Organization admins have access to all namespaces on the cluster.
To see which namespaces are available to you:
kubectl get namespacesAdmin vs Regular User Permissions
| Regular User | Organization Admin | |
|---|---|---|
| Cluster groups | cluster-scope + group names | cluster-scope + cluster-admins + group names |
| Namespace access | Only namespaces matching their group memberships | All namespaces |
| Use case | Day-to-day workload management within group namespaces | Full cluster administration |
Organization admins are automatically added to the cluster-admins group, which grants elevated permissions across the cluster.
Troubleshooting
"kubectl not found"
The pw kube auth command requires kubectl to be installed and available on your PATH. Install it by following the official Kubernetes documentation.
Token Errors
If you see authentication errors when running kubectl commands:
- Verify that you are logged in to the PW CLI (
pw auth status). - Re-run
pw kube auth <cluster-name>to refresh your kubeconfig. - Confirm the cluster is still available with
pw kube ls.
Wrong Context
If kubectl is targeting the wrong cluster, check and switch your context:
kubectl config current-context
kubectl config use-context pw#<cluster-name>