0

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
  • 76
  • 1
  • 7
  • "pod name and pod ip from the springboot application inside the container" ...this... is a problem. You are starting to pet cattle here – so-random-dude Feb 26 '19 at 18:50

2 Answers2

1

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
  • 3,334
  • 1
  • 26
  • 30
1

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

P Ekambaram
  • 15,499
  • 7
  • 34
  • 59