k8s: Uniform API server access using clientcmd
Kubernetes Official Blog
2026-01-19
This article explains how to use the clientcmd library (part of client-go) to make Go CLI tools access the Kubernetes API with the same kubeconfig/kubectl semantics users expect. It covers loading rules, configuration overrides, building and binding flags, merging behavior, creating a merged ClientConfig (interactive or non-interactive), and obtaining a kubernetes client, plus relevant gotchas and an example.