An Endpoint in Kubernetes is an object in Kubernetes that implements a Service. They represent the set of IPs for Pods that match a particular service. They are handy when you want to check that a Service actually matches some running pods. It provides a way to represent a remote system as an internal service. If an Endpoint is empty, then it means that there are no matching pods and something is most likely wrong with your service definition. Each Service object in Kubernetes has an associated Endpoint object. A corresponding endpoint with the same name of the Service is created when a Service is created with a Selector. The Endpoint of each Service in the cluster are being watched by the Kube-proxy for the purpose of routing network request made to virtual IPs to the endpoint which implements the Service. We can manually create Endpoints for a Service that has no Selector. Below is an example of a manually created Endpoint and it’s associated Service.
kind: Endpoints apiVersion: v1 metadata: name: test-endpoint subsets: - addresses: - ip: 22.214.171.124 ports: - port: 9376
kind: Service apiVersion: v1 metadata: name: test-endpoint spec: ports: - protocol: TCP port: 80 targetPort: 9376