'How to view properties of running spring boot application from command line [duplicate]

I have an application deployed to k8s (linux). The application is not working as expected. I want to verify that the properties created using Application.yml are correct.

Application.yml looks like this

foo:
  bar: ${FOO_BAR}
  baz: ${FOO_BAZ}

When I shell into the pod and run env | grep FOO I see that the values of FOO_BAR and FOO_BAZ are what I expect. I want to verify that in the Spring Boot application foo.bar and foo.baz are also correct.

Is there a command I can run from the command line that will print out the values of foo.bar and foo.baz?

I've tried:

jinfo <pid> - Does not output the values I am looking for

jps and jps -v - No output



Solution 1:[1]

you can run shell command on a running pod as shown below

kubectl -n namespace exec -it pod-name -- /bin/bash -c "command(s)"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 P Ekambaram