Interacting with Clusters Using the Kubernetes API
Up until now, we've been using the Kubernetes kubectl command-line tool, which made interacting with our cluster quite convenient. It does that by extracting the API server address and authentication information from the client kubeconfig file, which is located in ~/.kube/config
by default, as we saw in the previous chapter. In this section, we will look at the different ways to directly access the API server with HTTP clients such as curl.
There are two possible ways to directly access the API server via the REST API—by using kubectl in proxy mode or by providing the location and authentication credentials directly to the HTTP client. We will explore both methods to understand the pros and cons of each one.
Accessing the Kubernetes API Server Using kubectl as a Proxy
kubectl has a great feature called kubectl proxy, which is the recommended approach for interacting with the API server. This is recommended because...