Introduction to Kubernetes API

Get introduced to the Kubernetes API.

We'll cover the following

To master Kubernetes, we need to understand the API and how it works. However, it’s large and complex, and it can be confusing if we’re new to APIs and uncomfortable with terms like RESTful. This chapter will blow away the confusion and get us up to speed with the fundamentals of the Kubernetes API.

Let’s mention a few quick things before getting started.

This chapter includes lots of jargon, so you can get comfortable with it. We also highly recommend that you complete the hands-on parts, as they’ll help reinforce the theory.

Finally, Pods, Services, StatefulSets, StorageClasses, and more are all resources in the API. However, it’s common to call them objects when deployed to a cluster. We’ll use the terms resource and object interchangeably.

The big picture

Kubernetes is API-centric — all resources are defined in the API, and all communication goes through the API server.

Administrators and clients send requests to create, read, update, and delete objects like Pods and Services. For the most part, we’ll use kubectl to send these requests. However, we can craft them in code or generate them through API testing and development tools. The point is, no matter how we generate requests, they always go to the API server where they’re authenticated and authorized. They’ll be executed on the cluster if they pass the auth tests. If it’s a create request, the object is deployed to the cluster and persisted to the cluster store in its serialized state.

Figure 15.1 shows the high-level process and highlights the central nature of the API and API server.

Get hands-on with 1400+ tech skills courses.