Kubernetes — Service Types Overview (2024)

Table of Contents
TL;DR Use Cases Example

Introduction to Service types in K8s — Types of Kubernetes Services.

Kubernetes — Service Types Overview (3)

TL;DR

There are four types of Kubernetes services — ClusterIP, NodePort, LoadBalancer and ExternalName. The type property in the Service's spec determines how the service is exposed to the network.

Read about Kubernetes Services and Ingress

  • ClusterIP is the default and most common service type.
  • Kubernetes will assign a cluster-internal IP address to ClusterIP service. This makes the service only reachable within the cluster.
  • You cannot make requests to service (pods) from outside the cluster.
  • You can optionally set cluster IP in the service definition file.

Use Cases

  • Inter service communication within the cluster. For example, communication between the front-end and back-end components of your app.

Example

  • NodePort service is an extension of ClusterIP service. A ClusterIP Service, to which the NodePort Service routes, is automatically created.
  • It exposes the service outside of the cluster by adding a cluster-wide port on top of ClusterIP.
  • NodePort exposes the service on each Node’s IP at a static port (the NodePort). Each node proxies that port into your Service. So, external traffic has access to fixed port on each Node. It means any request to your cluster on that port gets forwarded to the service.
  • You can contact the NodePort Service, from outside the cluster, by requesting <NodeIP>:<NodePort>.
  • Node port must be in the range of 30000–32767. Manually allocating a port to the service is optional. If it is undefined, Kubernetes will automatically assign one.
  • If you are going to choose node port explicitly, ensure that the port was not already used by…
Kubernetes — Service Types Overview (2024)
Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 5615

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.