Access Service Endpoints
Closed this issue · 1 comments
Oliver-Fish commented
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?
ericchiang commented
I think you want pod.Status.PodIP https://godoc.org/github.com/ericchiang/k8s/apis/core/v1#PodStatus
First result on Google btw :)