Skip to main content

Kubeconfigs in CKS

Learn about creating Kubeconfig files in CKS Clusters through Managed Auth

In Kubernetes, Kubeconfig files are YAML configuration files used to manage access to Kubernetes clusters by specifying the details required to authenticate and interact with the cluster's API server. It allows you to execute commands without needing to repeatedly specify cluster connection details or credentials.

Using Managed Auth, CKS Kubeconfig files are generated for you from the Cloud Console. These Kubeconfig files follow the permissions configured for their related tokens, and embed the related API Access Token automatically with the Kubeconfig.

Here is an example of a Kubeconfig file generated using Managed Auth via the Cloud Console.

Example
apiVersion: v1
clusters:
- cluster:
server: https://api-server.url.com
name: my-cluster
contexts:
- context:
cluster: my-cluster
namespace: my-namespace
user: token
name: my-cluster
current-context: my-cluster
kind: Config
preferences: {}
users:
- name: token
user:
token: REDACTED

Generated Kubeconfig files also contain the following values, and they may contain additional values:

FieldDescription
apiVersionThe API group version
clustersConnection settings for the target cluster, including the API server addresses
clusters.cluster.serverAPI server addresses
clusters.cluster.nameThe cluster name
contextsThe Kubernetes context containing the related cluster, user, and namespace name
contexts.context.clusterThe cluster associated with the context
contexts.context.namespaceThe namespace associated with the context
contexts.context.userThe user associated with the context, in this case an API Access Token token (token)
usersA list of "users" associated with the context, in this case the API Access Token (token)
users.nameThe name of the user, in this case the Access Token, token
users.user.tokenThe actual Access Token value

Next up