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.
apiVersion: v1clusters:- cluster:server: https://api-server.url.comname: my-clustercontexts:- context:cluster: my-clusternamespace: my-namespaceuser: tokenname: my-clustercurrent-context: my-clusterkind: Configpreferences: {}users:- name: tokenuser:token: REDACTED
Generated Kubeconfig files also contain the following values, and they may contain additional values:
Field | Description |
---|---|
apiVersion | The API group version |
clusters | Connection settings for the target cluster, including the API server addresses |
clusters.cluster.server | API server addresses |
clusters.cluster.name | The cluster name |
contexts | The Kubernetes context containing the related cluster, user, and namespace name |
contexts.context.cluster | The cluster associated with the context |
contexts.context.namespace | The namespace associated with the context |
contexts.context.user | The user associated with the context, in this case an API Access Token token (token ) |
users | A list of "users" associated with the context, in this case the API Access Token (token ) |
users.name | The name of the user, in this case the Access Token, token |
users.user.token | The actual Access Token value |
Next up
- Learn how to create and manage CKS Kubeconfig files.
- Learn about API Access Tokens in CKS.