API Analogy

Learn about the Kubernetes API and how it works.

We'll cover the following

Introduction to API analogy

Let's consider a quick analogy that will help us conceptualize the Kubernetes API.

Amazon sells lots of stuff:

  1. That stuff is stored in warehouses and exposed online on the Amazon website.

  2. We use tools like browsers and apps to search the website and buy stuff.

  3. Third parties sell their own stuff through Amazon, and we use the same browser and website.

  4. When we buy stuff through the website, it gets delivered to us, and we can start using it.

  5. The Amazon website lets us track our stuff while it’s being prepared and delivered.

  6. Once it’s delivered, we can use Amazon to order more or send stuff back.

Well, Kubernetes is very similar.

Kubernetes has lots of resources (stuff) such as Pods, Services, and Ingresses:

  1. These resources are defined in the API and exposed through the API server.

  2. We use tools like kubectl to talk to the API server and request resources.

  3. Third parties even define their own resources in Kubernetes, and we use the same kubectl and API server to request them.

  4. When we request a resource through the API server, it gets created on our cluster, and we can start using it.

  5. The API server lets us watch it being created.

  6. Once it’s created, we can use the API server to create more and even delete stuff.

The following figure shows the comparison, and we can see a feature-for-feature comparison in the following table. However, remember that this is just an analogy, and not everything matches perfectly.

Get hands-on with 1400+ tech skills courses.