![]() While the traditional use of a Kubernetes Service is to abstract one or more pods behind a layer, services can do more than that. ![]() Notice that if you are defining more than one port in a service, you must provide a name for each port so that they are recognizable. ![]() Let’s create a NodeJS service definition. ![]() Like all other Kubernetes objects, a Service can be defined using a YAML or JSON file that contains the necessary definitions (they can also be created using just the command line, but this is not the recommended practice). Pods can be configured to talk to the Service, and know that communication to the Service will be automatically load-balanced out to some pod that is a member of the Service. This address is tied to the lifespan of the Service, and will not change while the Service is alive. When created, each Service is assigned a unique IP address (also called clusterIP). This leads to a problem: if some set of Pods (call them “backends”) provides functionality to other Pods (call them “frontends”) inside your cluster, how do the frontends find out and keep track of which IP address to connect to, so that the frontend can use the backend part of the workload?Ī Kubernetes Service is an abstraction which defines a logical set of Pods running somewhere in your cluster, that all provide the same functionality. Each Pod gets its own IP address, however in a Deployment, the set of Pods running in one moment in time could be different from the set of Pods running that application a moment later. If you use a Deployment to run your app, it can create and destroy Pods dynamically. They are born and when they die, they are not resurrected. ![]() In theory, you could talk to these pods directly, but what happens when a node dies? The pods die with it, and the Deployment will create new ones, with different IPs. Say, you have pods running nginx in a flat, cluster wide, address space. What are Kubernetes Services? | kubelabs Star Fork Watch Follow What are Kubernetes Services? Kubernetes - Beginners | Intermediate | Advanced View on GitHub Join Slack Kubectl Cheatsheet Kubernetes Tools What are Kubernetes Services? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |