liveBook · Manning

Kubeconfig

As explained in Google Anthos in Action

A kubeconfig is a configuration file containing the connection details, credentials, and contexts that Kubernetes client tools use to access clusters.

A kubeconfig is a Kubernetes client configuration file that records cluster connection details, credentials, and contexts. Client tools such as kubectl use it to select and access clusters. section 3.2 section 5.3

A kubeconfig can define:

  • A cluster name, API server address, and certificate-authority data. section 5.3
  • A user identity, such as a service account token. section 5.3
  • A context that associates a cluster with a user and can become the current context. section 5.3
  • Different access targets, such as a load-balanced admin-cluster address or an internal API server address. section 3.2

Registering an external cluster

An administrator can generate a kubeconfig for an EKS, AKS, or conformant Kubernetes cluster and provide it to a gcloud cluster-registration command. A manually assembled configuration supplies certificate data, server information, a service-account token, and a named context. section 5.3

Connecting without a jump host

After configuring service-account impersonation, an administrator can use gcloud to generate a kubeconfig for an Anthos-registered cluster. kubectl then reaches the cluster through the Connect Agent from a local machine, with access secured by Google Cloud Identity. section 5.5

apiVersion: v1
kind: Config
users:
- name: svcs-acct-dply
user:
 token: <replace this with token info>
clusters:
- cluster:
 certificate-authority-data: <replace this with certificate-authority-data info>
 server: <replace this with server info>
name: self-hosted-cluster
contexts:
- context:
 cluster: self-hosted-cluster
 user: svcs-acct-dply
name: svcs-acct-context
current-context: svcs-acct-context

Inspect a complete minimal configuration showing the Config object, cluster, user, context, token placeholder, certificate data, and server fields. section 5.3

How Google Anthos in Action covers it

How deep it goes
Defines cluster, user, and context entries and shows generated and manual configurations, but defers general kubeconfig troubleshooting.
Examples
Uses GKE on-prem configuration files, an external-cluster YAML template, and a gcloud-generated Connect gateway configuration.
What it assumes
Assumes Kubernetes cluster access, credentials, and relevant registration permissions, while demonstrating required configuration fields explicitly.
What you can do after
Operate/configure kubectl access to registered clusters from an administrator workstation or local machine.
How it connects
Connects Kubernetes clusters, kubectl, gcloud, Anthos, Connect Agent, service-account impersonation, and Google Cloud Identity.

Also explained in

Compare how 3 books explain kubeconfig →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.