Get pod name and ip from Springboot application

2/26/2019

I have a SpringBoot application, dockerized, and deployed in a kubernetes cluster. There is any way to log the pod name and pod ip from the springboot application inside the container?

Thanks in advance.

-- rocky
azure-aks
docker
java
kubernetes
spring-boot

2 Answers

2/26/2019

One approach is to run a Fluentd agent on each cluster node. The agent collects all pod sysouts, decorates the logs with pod attributes and pipes them into ElasticSearch or some other searchable store. ala kubernetes-fluentd

-- MarkOfHall
Source: StackOverflow

2/26/2019

You should be using downwardAPI to capture pod name and pod ip as environment variables inside container

-- P Ekambaram
Source: StackOverflow