how to spring boot application source code from jar file on kubernetes

9/16/2020
➜  ~ kubectl exec -it my_pod /bin/sh -n my_team
sh-4.2$ ls
elastic-apm-agent.jar  logs  run.sh  my-app.jar
sh-4.2$ 

I want to see my application's source code (my-app.jar). This is a spring boot application. How can i see it?

Summary - I want to view a controller file of my spring boot project which is deployed on k8 pod.

-- Pooja Verma
docker
java
kubernetes
spring-boot

1 Answer

9/16/2020

For compiled languages (Java, C++, Rust, Go, ...) a typical Docker image won't contain its source code, and that source code won't be present at all in an environment like Kubernetes. You need to find some other path to retrieve it, like the original source-code repository.

This differs from interpreted languages Python, Javascript, Ruby, ... where the source code is required to run the application, and for those languages it can be easily extracted from the image or the deployment environment.

-- David Maze
Source: StackOverflow