# Exhaustive EndpointSlice reference (discovery.k8s.io/v1). # EndpointSlices are the address lists behind a Service: each entry says # "IP X serves port Y, ready or not". Normally the endpoint controller writes # them automatically from the Service selector. You write one by hand in a # single case: a selector-less Service pointing OUTSIDE the cluster (a host # daemon, a LAN appliance, an external database). The pair looks like: # Service (no selector, same port names) + this EndpointSlice. apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: app-external-abc123 namespace: example labels: # kubernetes.io/service-name: THE binding label. It must equal the # selector-less Service name - this is what attaches the slice to it. # The endpoint controller owns slices it creates; hand-written ones # just need this label to be picked up. kubernetes.io/service-name: app-external-service app: app annotations: description: "hand-written slice for an off-cluster backend" # addressType: IPv4, IPv6, or FQDN. All endpoints in one slice share it - # mix families with one slice per family. addressType: IPv4 ports: - name: http # name: MUST match the Service port name it serves. protocol: TCP # port: the REAL backend port (may differ from the Service port - the # Service port is the in-cluster alias, this is where packets go). port: 8080 # appProtocol: payload hint, mirrors the Service field. appProtocol: http endpoints: # One entry per backend address. kube-proxy load-balances across the ones # whose conditions say ready+serving+terminating=false. - addresses: # addresses: one or more IPs (or a single DNS name for FQDN slices). - 192.168.1.50 conditions: # ready: backend accepts traffic. False removes it from rotation # without deleting the entry (flap-friendly). ready: true # serving: the process is up. Differs from ready during shutdown: # serving=false + terminating=true = draining. serving: true # terminating: the endpoint is going away. Draining traffic, not dead. terminating: false # hostname: DNS name published for this endpoint (headless Services). # hostname: backend-1 # targetRef: link back to the pod/node object (set automatically on # controller-managed slices; omit on hand-written ones). # targetRef: # kind: Pod # namespace: example # name: app-67890abcde-fghij # uid: 12345678-1234-1234-1234-123456789abc # nodeName: the node hosting this endpoint (topology-aware routing). # zone: override the endpoint zone (defaults from nodeName). # hints: topology hints for zone-aware routing (PreferClose). # hints: # forZones: # - name: zone-a