Using kubectl to interact with the API is a great way to familiarize yourself with it, but it’s not the best way to develop an application that interacts with the API. When you run a “raw” command to get pods, you are getting all the pods in your cluster. The output is a JSON response, rather than a nicely formatted output.There are two key differences compared to the normal kubectl get pods approach:
You can use kubectl get -raw / to get a list of different resources, too, for example, getting all pods by running kubectl get -raw /api/v1/pods. You can also use curl You can also run kubectl get -raw /, and you should get the same response as you would using kubectl proxy -port=8080. Go to and get a response, telling you what paths are available to be queried. Run kubectl proxy -port=8080, and as long as the command is successful, you should be able to open your browser. The easiest way to get started with the Kubernetes API is by using kubectl. Let’s go over a few options of how you can get started.
Since you’re working with a REST API, your main concern is getting access and understanding the possibilities, rather than learning a new framework. Whether you’re developing an application that interacts with your cluster directly or you just want to check out what possibilities are available in the API, rest assured there’s an easy way to get started. Using the Kubernetes APIĭepending on your use case, there are many different ways to interact with the Kubernetes API. You can read more about the components of Kubernetes here. Rather than building a specific API purely for one purpose, the creators of Kubernetes decided to create a general API, making it easier for people to contribute and expand on their clusters. There are multiple components that need to communicate with each other in order to carry out specific tasks. You can think of Kubernetes as an all-encompassing service that consists of several microservices. Even when you’re not deep in the roots of your cluster, internal services are communicating with each other, making sure that your cluster is healthy. You may not realize it, but nearly everything you do when managing your cluster interacts with the API. Kubernetes API Overview How Important Is the Kubernetes API?Įverything in Kubernetes revolves around the API. Over the course of this article, you’ll get a feel for how you can interact with the Kubernetes API, how it can be used, and how you can secure the API once you start using it in production. To make life even easier, there are many client libraries available if you want to integrate the API directly into your application.
The Kubernetes API follows the traditional CRUD pattern, making it possible to focus more on what you can do with the API rather than spending time learning its structure. As long as you’ve worked with another API beforehand, you won’t have to learn any new principles for communicating with it. The Kubernetes API in particular is RESTful. This request goes through the API, which then hands it over to the right internal services.Īn API can be anything that’s used for programmatic communication. When you run kubectl apply, you are sending a request that tells the control plane to create your resources. The entire kubectl tool is essentially a wrapper around this API.
Every action inside your Kubernetes cluster goes through the API.
So as a container orchestration platform, Kubernetes automates a lot of the manual processes involved in managing, deploying, and scaling containerized apps.īy grouping together the machines (physical or virtual servers known as "nodes") running the containerized apps, you create a cluster, which you then manage and orchestrate with Kubernetes.Ī group of containers running on a single machine or node, and sharing resources, is known as a "pod" though a pod can also only have one container, in which case you can replace the word "pod" with the word "container" and still have the correct concept.The Kubernetes API is what makes a cluster tick.
A container is technology that lets you bundle and isolate applications with their entire runtime environment so that it’s easy to move the contained application between stages (development, production, etc.) and environments (on-premise, public cloud, private cloud, hybrid cloud, or multicloud) while retaining full functionality. Kubernetes is an open source platform for orchestrating containers. To understand the full context of the Kubernetes API, let’s back up and take a high-level look at what Kubernetes is.