Endpoints

An "Endpoints" resource lists the IPs and ports that handle a service.

If you create a Service without specifying a selector, you will need to create/maintain your own Endpoints.

Endpoints descriptor

The Endpoints' name must match the service's name.

List the IP addresses and ports that handle the service.

apiVersion: v1
kind: Endpoints
metadata:
  # must match the service's name
  name: external-service
subsets:
  # list IPs and ports
  - addresses:
      - ip: 11.11.11.11
      - ip: 22.22.22.22
    ports:
      - port: 80

Working with Endpoints

You already know the drill!

From this point onwards, I will only list "interesting" use cases.

Remember how you can create, delete, modify, and/or query a resource:

  • create a resource kubectl create -f <file>
  • modify a resource kubectl apply -f <file>
  • list resources kubectl get <resourceKind>
  • describe a resource kubectl describe <resourceKind> <resourceName>
  • delete a resource kubectl delete <resourceKind> <resourceName>

References

  • Kubernetes in Action (Marko Lukša)Chapter 5. Services: enabling clients to discover and talk to pods