Kubernetes - Get value of a specific metadata when using describe command

5/14/2018

When ruining kubectl describe service MyService command and can get the details of my kubernetes service as per below sample: enter image description here

I am only interested to get the value of LoadBalancer Ingress metadata. Is there a way to retrieve this specific metadata using kubectl describe command?

-- Benjamin
kubernetes

2 Answers

5/14/2018

How do you define "LoadBalancer Ingress metadata"? The IP address? If so, that information should appear under "IP:", right on top of LoadBalancer Ingress. But the LoadBalancer type service is cloud provider specific.

Do you actually have an IP address assigned to that specific load balancer?

-- suren
Source: StackOverflow

5/14/2018

I think it's better to use the get method and the go-template output :

kubectl get svc MyService -o go-template --template='{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}'

Otherwise (but I don't recommend it), use bash tools like grep and cut

kubectl describe svc MyService | grep "LoadBalancer Ingress" | cut -d ':' -f2
-- Nicolas Pepinster
Source: StackOverflow