Types of services

  • Kubernetes service is an abstract way to access an application running on a set of pods.
  • Set of pods targeted by a service is determined by a label selector.
  • Three types of services:

      1. ClusterIP:-

  • This is the default service type. 
  • It exposes the service on a cluster internal IP.

      2. NodePort:

  • NodePort where the service makes an internal pod accessible on the node.
  • It is the very basic way to get external traffic directly to your service.

      3. LoadBalancer: 

  • If you create a LoadBalancer it creates a NodePort which then creates a ClusterIP.
  • This will give you a single IP address that will forward all traffic to your service.


Task by trainer:-

1. Create  a deployment for a super mario game.

  1. Deployment name = mario
  2. Service name = mario
  3. Service Type = NodePort
  4. Port = 8080
  5. Image = docker.io/pengbai/docker-supermario

2. Create a deployment for a car racing game

  1. Deployment name = car
  2. Service name = car
  3. Service type = NodePort
  4. Port = 8181
  5. Image = docker.io/playpalash/car-racing:01