16 Sep 2024 07:59 AM
Hi All,
Please let me know whether there is any kubectl command to check Dynatrace operator version installed on k8s cluster, I know we can check it from DT UI (from kubernetes UI or from Host->Properties UI), but I want it to fetch from cmd line to automate operator upgrade process.
Please guide, thanks.
Guru Gogi
Solved! Go to Solution.
16 Sep 2024 08:16 AM
kubectl exec deploy/dynatrace-operator -n dynatrace -- dynatrace-operator troubleshoot
The troubleshoot option reveals the version. There might be a simpler method to obtain it.
16 Sep 2024 10:35 AM
@PacoPorro thanks for your reply. I know this command output has operator version, but I was checking whether we can modify this command so that it shows only operator version.
kubectl exec -n dynatrace deployment/dynatrace-operator -- dynatrace-operator support-archive --stdout > operator-support-archive.zip
[support-archive] dynatrace-operator {"version": "v0.11.0", "gitCommit": "...", "buildDate": "...", "goVersion": "...", "platform": "linux/amd64"}
[support-archive] Storing operator version into operator-version.txt
17 Sep 2024 07:00 AM
If you are after only the operator version you can try the below
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}'
17 Sep 2024 07:16 AM
@p_devulapalli thanks for reply, its working, its printing % also at the end, need to check how I can remove this % from output.
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}' 1.0.0%
17 Sep 2024 07:27 AM - edited 17 Sep 2024 07:52 AM
It should not be adding any % , may be a issue with prompt/formatting. Can you please try the below, it should output to next line clearly
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}{"\n"}'
17 Sep 2024 08:03 AM
@p_devulapalli this has eliminated %, thank you very much.
kubectl get deployment dynatrace-operator -n dynatrace -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}{"\n"}'