Prophaze WAF Blog

Kubernetes Service Types - Cloud WAF

Written by Maneesha Mariam | Jan 18, 2021 3:10:11 PM

Key Terms

  • Nodes: Virtual host(s) on which containers/pods are running.

  • Kubernetes Service: A logical set of pods that perform identical functions. These will be accessed through the DNS name of the service.

Types of Kubernetes Services

There are four types of services that are defined by how they expose the service outside the cluster. The service type is set by using one of the following values for spec. type:

1. ClusterIP

  • Default service type.
  • Exposes the service on a cluster-internal IP, that’s accessibility is merely permissible from inside the defined Kubernetes cluster
  • Helps in limiting the service inside the cluster

2. NodePort

  • Exposes a service via a static port on every node’s IP.
  • These are the open ports on each cluster node.
  • While using services in Nodeport, ensure that the chosen port isn’t already opened on your nodes
  • A ClusterIP service is designed automatically, and therefore the NodePort service can route to that. From outside the cluster, NodePort service will be accessed by “:”.
  • NodePorts Kubernetes can route traffic that comes into a NodePort to the service, even though the service isn’t running on that node.
  • NodePort is meant as a foundation for different higher-level strategies of ingress like load balancers and are helpful in development.

3. LoadBalancer

  • Exposes the service through the cloud provider’s load balancer.
  • This service will create an internal Kubernetes Service is connected to a cloud provider’s Load Balancer. It can create a publicly addressable set of IP addresses and a DNS name which can be used to access your cluster from an external source.
  • NodePort and ClusterIP services are created automatically to that the external load balancer can route. It will offer firewall rules if required, and populate the service with the external IP address assigned by the cloud provider.

4. ExternalName

  • The service is mapped to a DNS name (e.g., like.this.example.com), to not a typical selector (e.g., my-service).
  • While creating the service, the user can mention the CNAME with the “spec.externalName parameter”. It does this by returning a value for the CNAME record.
  • ExternalName services are being accessed through a clusterIP address