This event triggers the ReplicaSet controller, which is a sub-process of the controller manager. The API server authenticates the request and saves your ReplicaSet resource definition in the storage backend. The API request to the create ReplicaSet endpoint is handled by the API server. What effects causes this in the cluster? Watch it below:Īnd here follows the textual description. To see how these components work together, let's consider an example.Īssume, you just executed kubectl create -f replicaset.yaml, upon which kubectl made an HTTP POST request to the create ReplicaSet API endpoint (passing along your ReplicaSet resource definition). Kubelet: manages execution of containers on a worker node.Scheduler: schedules Pods to worker nodesĪnd this is the most important component on the worker nodes:.Controller manager: ensures resource statuses match specifications.API server: provides Kubernetes API and manages storage backend.Storage backend: stores resource definitions (usually etcd is used).These are the most important components on the master nodes: Some components run on the master nodes and others run on the worker nodes, and each component has a very specific function. Kubernetes consists of a set of independent components that run as separate processes on the nodes of a cluster. To this end, let's briefly dive into the Kubernetes internals. But there is much more about the Kubernetes API that every kubectl user should know. These are the basics of what kubectl is and how it works. Kubectl just makes it easier for you to use the Kubernetes API. Note that it's totally possible to control Kubernetes with a tool like curl by manually issuing HTTP requests to the Kubernetes API. In all these cases, kubectl simply makes HTTP requests to the appropriate Kubernetes API endpoints. This is how kubectl works for all commands that interact with the Kubernetes cluster. The ReplicaSet definition (that you provided in the replicaset.yaml file) is passed in the body of the request. To make an actual request to an endpoint, you need to prepend the URL of the API server to the endpoint paths that are listed in the API reference.Ĭonsequently, when you execute the above command, kubectl makes an HTTP POST request to the above API endpoint. You can find the API endpoints of all Kubernetes operations in the API reference). POST /apis/apps/v1/namespaces//replicasets To do so, you would define the ReplicaSet in a file named replicaset.yaml file, and then run the following command: Imagine you want to create a ReplicaSet resource. For this reason, the Kubernetes API reference is organised as a list of resource types with their associated operations. You fully control Kubernetes by manipulating these resources (and Kubernetes figures out what to do based on the current state of resources). That means, Kubernetes maintains an internal state of resources, and all Kubernetes operations are CRUD operations on these resources. Kubernetes is a fully resource-centred system. This means that every Kubernetes operation is exposed as an API endpoint and can be executed by an HTTP request to this endpoint.Ĭonsequently, the main job of kubectl is to carry out HTTP requests to the Kubernetes API: Kubernetes is fully controlled through this API. This API is the real Kubernetes user interface. It allows you to perform every possible Kubernetes operation.įrom a technical point of view, kubectl is a client for the Kubernetes API. Save typing with auto-generated aliasesīefore learning how to use kubectl more efficiently, you should have a basic understanding of what it is and how it works.įrom a user's point of view, kubectl is your cockpit to control Kubernetes. Switch between clusters and namespaces with ease The goal of this article is not only to make your daily work with Kubernetes more efficient but also more enjoyable! Contents At the same time, it aims at deepening your understanding of how various aspects of Kubernetes work. This article contains a series of tips and tricks to make your usage of kubectl more efficient and effective. Whenever you spend a lot of time working with a specific tool, it is worth to get to know it very well and learn how to use it efficiently. If you work with Kubernetes, then kubectl is probably one of your most-used tools.
0 Comments
Leave a Reply. |