java process inside kubernetes pod running with pid1

9/12/2018

I have a scala app running as a docker container inside kubernetes pod. I use sbt native packager to build the app. Now when I go into my app pod kubectl exec it pod sh , and do ps -ef | grep Java I see that Java is running with pid 1 . I want to change this to run my Java process with any other pid than 1. Can anyone help me with this?

-- nocturnal
docker
java
kubernetes

1 Answer

9/12/2018

The first process in your container will start with PID 1, and there is no way to change this behaviour. However, it is possible to run your app with other PID by using init process or supervisor for your Java app. You can find detailed information about this approach in here

-- getslaf
Source: StackOverflow