Get the pods in Operator Namespace :
Syntax:
kubectl get pods -n <operator_namespace>
Command :
bash-3.2$ kubectl get pods -n sample-weblogic-operator-ns
NAME READY STATUS RESTARTS AGE
weblogic-operator-webhook-b96d4b5d6–7cvqs 1/1 Running 0 71s
weblogic-operator-88fc58c65-jfxs6 1/1 Running 0 71s
Use kubectl exec to get a shell to the Operator Pod container :
Syntax:
kubectl exec -it <operator_pod> -n <operator_namespace> -- /bin/bash
Command:
bash-3.2$ kubectl exec -it weblogic-operator-88fc58c65-jfxs6 -n sample-weblogic-operator-ns -- /bin/bash
Use “jps” command to get list of running java processes:
Command:
bash-5.1$ jps
209 Jps
15 weblogic-kubernetes-operator.jar
Start JFR recording using JCMD utility
Syntax:
jcmd <pid> JFR.start duration=<in_seconds> filename=<filename.jfr>
Command:
bash-5.1$ jcmd 15 JFR.start duration=10s filename=/tmp/my.jfr
15:
Started recording 1. The result will be written to:
/tmp/my.jfr
bash-5.1$ cd /tmp/
bash-5.1$ ls
2023_10_17_03_59_36_15 hsperfdata_oracle hsperfdata_root my.jfr
bash-5.1$ exit
exit
Copy the JFR recording to your local machine:
Syntax:
kubectl cp <pod-id>:<path> <local-path> -n <namespace>
Command:
bash-3.2$ kubectl -n sample-weblogic-operator-ns cp weblogic-operator-88fc58c65-jfxs6:/tmp/my.jfr ~/Desktop/my.jfr
bash-3.2$
Demo :