get_endpoint

Function get_endpoint 

Source
pub async fn get_endpoint(
    client: &Client,
    namespace: &str,
    service_name: &str,
    port_name: &str,
) -> Result<Vec<EndpointAddress>>
Expand description

Get all endpoints for a service with a specific port name

Looks up the Kubernetes Endpoints object associated with a service and returns all pod IP addresses with their corresponding container ports.

When connecting directly to pod IPs, you must use the container port from the endpoints, not the service port.

§Arguments

  • client - Kubernetes API client
  • namespace - Namespace of the service/endpoints
  • service_name - Name of the service (endpoints have the same name)
  • port_name - Name of the port to lookup (e.g., “http”, “dns-tcp”)

§Returns

Vector of EndpointAddress containing pod IP and container port pairs

§Errors

Returns error if:

  • Endpoints object doesn’t exist
  • Port name not found in any endpoint subset
  • No ready addresses found