is there any way to see the entrypont command in kubernetes

6/14/2020

I am using entrypoint to start my app, now I use a variable in entrypoint and passed this variable in kubernetes pod env variable when running, this is my docker file:

FROM openjdk:8-jre-alpine

MAINTAINER jiangxiaoqiang (jiangtingqiang@gmail.com)

ENV LANG=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8 \
    TZ=Asia/Shanghai


RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo $TZ > /etc/timezone \
    && apk add --no-cache curl jq procps

ADD soa-service/build/libs/soa-service-1.0.0-SNAPSHOT.jar /root/soa-service-1.0.0-SNAPSHOT.jar
ADD script/start-docker.sh /root/start-docker.sh

EXPOSE 11005

ENTRYPOINT exec java -Dfile.encoding=UTF-8 -Xmx256M -Xms128M \
                -Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=5007 \
                -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/dump \
                -javaagent:/opt/skywalking/agent/skywalking-agent.jar=agent.service_name=soa-service \
                -Dskywalking.agent.service_name=soa-service \
                -Dskywalking.collector.backend_service=$SKYWALKING_ADDR \
                -jar /root/soa-service-1.0.0-SNAPSHOT.jar

and pass kubernetes env variable in yaml like this:

"env": [
					{
						"name": "SKYWALKING_ADDR",
						"value": "10.106.251.29:11800"
					}]

now the question is I am not sure this configuration works fine. I want to see the variable is passed successfully.what should I do to see the startup command of entrypoint?

-- Dolphin
kubernetes

1 Answer

6/14/2020

Find your pod name using

kubectl get pods

Log into the running pod and execute bash:

kubectl exec -it yourpodname bash

Execute ps command with -aux to see more details on running processes and filter for java

ps -aux | grep java

Example output:

cnb 1 0.1 8.4 456540 171884 ? Ssl Jun13 3:28 java -cp /workspace -XX:ReservedCodeCacheSize=40M -XX:MaxMetaspaceSize=60M -Xlog:gc -Xms36m -Xmx40m -Xss256k -XX:MaxRAM=150M -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -agentpath:/layers/paketo-buildpacks_bellsoft-liberica/jvmkill/jvmkill-1.16.0-RELEASE.so=printHeapHistogram=1 -XX:ActiveProcessorCount=2 -XX:MaxDirectMemorySize=10M org.springframework.boot.loader.JarLauncher

-- CoderPraBhu
Source: StackOverflow