I am currently working on a bash script to reduce the time it takes for me to build the db for a project.
Currently I have several databases running in the same namespace and I want to extract only the specific pod name.
I run kubectl get pods
NAME READY STATUS RESTARTS AGE
elastic 1/1 Running 0 37h
mysql 1/1 Running 0 37h
Now I want to save one of the pod names.
I'm currently running this foo=$(kubectl get pods | grep -e "mysql")
and it returns mysql 1/1 Running 0 37h which is the expected results of the command. Now I just want to be able to extract the pod name as that variable so that I can pass it on at a later time.