ericchiang/k8s

Access Service Endpoints

Closed this issue · 1 comments

When I use kubectl describe service I get a list of endpoint IP's

Endpoints: 10.20.0.75:9000

I am getting the services like this

	var services corev1.ServiceList
	if err := client.List(context.Background(), k8s.AllNamespaces, &services); err != nil {
		tr.Logger.Error(err.Error())
		return
	}
	for _, p := range services.Items {
			tr.Logger.Info(fmt.Sprintf("Name: %v IP:", p.GetMetadata().GetName()))
		}
	}

But I can't work out how to go about getting the pod IPs inside

Any ideas?