Uniform API server access using clientcmd
If you've ever wanted to develop a command line client for a Kubernetes API, especially if you've considered making your client usable as a kubectl plugin, you might have wondered how to make your client feel familiar to users of kubectl. A quick glance at the output of kubectl options might put a damper on that: "Am I really supposed to implement all those options?" Fear not, others have done a lot of the work involved for you. In fact, the Kubernetes project provides two libraries to help you handle kubectl-style command line arguments in Go programs: clientcmd and cli-runtime (which uses clientcmd). This article will show how to use the former. General philosophyAs might be expected since it's part of client-go, clientcmd's ultimate purpose is to provide an instance of restclient.Config
Source: Kubernetes ↗
If you've ever wanted to develop a command line client for a Kubernetes API, especially if you've considered making your client usable as a kubectl plugin, you might have wondered how to make your client feel familiar to users of kubectl. A quick glance at the output of kubectl options might put a damper on that: "Am I really supposed to implement all those options?" Fear not, others have done a lot of the work involved for you. In fact, the Kubernetes project provides two libraries to help you handle kubectl-style command line arguments in Go programs: clientcmd and cli-runtime (which uses clientcmd). This article will show how to use the former. General philosophyAs might be expected since it's part of client-go, clientcmd's ultimate purpose is to provide an instance of restclient.Config
This Coalition transmission preserves metadata, trust context, and source routing for a Developer Signal item from Kubernetes. The complete article remains with the original publisher.
Content handling is marked as Metadata Only. Use the source article link for the full report, updates, corrections, and publisher-controlled context.
Key Points
- Published by Kubernetes.
- Categorized as Developer Signal.
- Source handling: Verified Source.
- Rights posture: Metadata Only.
- Follow the source article for the complete original report.