Ok, there are similar questions, but not exactly what I am looking for.
I am working with Kubernetes, so the information is from that, but this question is for Shell Scripting, so please don't push me off to Kubernetes people. :)
I run the following command to get the information:
kubectl get pods -o wide --all-namespaces | grep sonarqube-
Result Example:
default sonarqube-664b4fd48-g6nvb 1/1 Running 0 4d 10.233.64.6 local-node-0
Goal: What I want is to take the first 2 values (default
and sonarqube-664b4fd48-g6nvb
) and turn them into variables that I can use elsewhere in the script.
Command Sample I want to use the variables in is like:
kubectl cp <file> ${namespace}/${deployment}:/opt/app/extensions/plugins/
Thanks, and please let me know if more information is needed.