Services
In Kubernetes, a Service is a method for exposing a network application that is running as one or more Pods in your cluster.
The Service API, part of Kubernetes, is an abstraction to help you expose groups of Pods over a network. Each Service object defines a logical set of endpoints (usually these endpoints are Pods) along with a policy about how to make those pods accessible.
Types of Services
ClusterIP
A ClusterIP service is a type of service that exposes the pods of a deployment or replica set internally within the cluster. When a ClusterIP service is created, it assigns an internal IP address to the service that can be used by other pods in the cluster to access the pods associated with the service.
ClusterIP services are often used for internal communication between microservices within the cluster.
NodePort
A NodePort service is a type of service that exposes the pods of a deployment or replica set externally on a specific port on each node in the cluster. When a NodePort service is created, it assigns a port number that is available on all nodes in the cluster and forwards traffic to the pods associated with the service.
NodePort services are often used for external access to a service, such as when exposing a web application to the internet.
LoadBalancer
A LoadBalancer service is a type of service that exposes the pods of a deployment or replica set externally using a cloud provider's load balancer. When a LoadBalancer service is created, the cloud provider provisions a load balancer that distributes traffic to the pods associated with the service
LoadBalancer services can be created using a YAML manifest that specifies the type of service and its associated properties, such as the port number, target port, and protocol. Once created, the LoadBalancer service can be accessed using the external IP address assigned by the cloud provider's load balancer.
Last updated