I want to get NAMESPACE, NAME, HOSTS, ADDRESS
of kubectl get ing -A
output.
I’ve tried to get it by
kubectl get ing -A --no-headers -o custom-columns='N:.metadata.namespace,NS:.metadata.name,H:.metadata.hosts'
but hosts
return <none>
values.
I think that’s for its not in metadata
area.
That makes sense – metadata does not have “hosts” as a legal field. For the ingress field, “hosts” is .spec.rules[*].host
Recall that custom columns are also jsonpath expressions.
As long as you know the schema for a resource (the output of getting the resource with -o yaml
) it is not hard to formulate the correct jsonpath query for the attribute you want. Please read this for a guide.