尝试插入输出:
kubectl get pods | grep -Eo '^[^ ]+' | grep portal
进入这个:
kubectl exec -it <here> portal bash
尝试过:
kubectl exec -it `kubectl get pods | grep -Eo '^[^ ]+' | grep portal ` portal bash
但没有运气。
答案1
kubectl exec -it "$(kubectl get pods | grep -Eo '^[^ ]+' | grep portal)" bash
或者,甚至更多:
kubectl exec -c portal-container -it "$(kubectl get pods | grep -Eo '^[^ ]+' | grep portal)" bash