A container can access the Kubernetes API, and query it for whatever
information you need, about any k8s component.
For example, I do the following in some of my containers to dynamically
lookup the IP of the kube-dns service:
curl -s \
--cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
--header "Authorization: Bearer $(cat
/var/run/secrets/kubernetes.io/serviceaccount/token)" \
https://10.43.0.1:443/api/v1/namespaces/kube-system/services/kube-dns \
| jq -r .spec.clusterIP
HTH,
DR
On 2017-11-30 4:16 pm, Kyunam Kim wrote:
How do I make a container aware of the service's IP:NodePort or
ClusterIP:port address?
Let's say, I can access my application at http://public-ip:port/myapp
from the external world.
I want a container(s) to be able to reach to http://public-ip:port
Or
to reach to ClusterIP:port.
What k8s' capability do I use to make this happen?
Thanks,
Kyunam
--
You received this message because you are subscribed to the Google Groups "Kubernetes
user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.