Now I am remote debugging my java program in kubernetes(v1.15.2) using kubectl proxy forward like this:
kubectl port-forward soa-report-analysis 5018:5018 -n dabai-fat
I could using intellij idea to remote connect my localhost port 5018 to remote debugging my pod in kubernetes cluster in remote datacenter,but now I am facing a problem is every time I must change the pod name to redebug after pod upgrade,any way to keep a stable channel for debugging?
I use this script to improve my workflow:
#!/usr/bin/env bash
set -u
set -e
set -x
kubectl get pods -n dabai-fat | grep "soa-illidan-service"
POD=$(kubectl get pod -l k8s-app=soa-illidan-service -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward ${POD} 11014:11014
This script automatic get the pod name and open remote debugging.