I want to create a script that will run port-forwarding for a pod automatically, for specific pod name(app3, I've multiple apps in this namespace and I need to run just for app3 ) when I run this script.
e.g.
kubectl port-forward pods/app3-86499b66d-dfwf7 8000:8000 -n web
I've started with
kubectl get pod -n webide-system | grep app3
The output is:
app3-86499b66d-dfwf7 1/1 Running 0 18h
However,Im not sure how to take the output, which is the pod name and run the port forwarding to it The following in bold is constant
pods/app3-86499b66d-dfwf7
And this is changing for each deployment
-86499b66d-dfwf7
Any idea how to make it works with a script?