[英]How to give the input for the kubectl command?
实际上,我正在尝试在一个命令中执行以下命令
kubectl get pods| grep -oP 'mag[^\s]+'
output
mag121111
之后,我将运行以下命令
kubectl exec -itmag121111 bash
现在我正在尝试如下
kubectl get pods| grep -oP 'mag[^\s]+' | kubectl exec -it bash
kubectl exec -it $(kubectl get pods| grep -oP 'mag[^\s]+') --/bin/bash
要么
kubectl exec -it $(kubectl get pods| grep -oP 'mag[^\s]+') --bash
kubectl exec -it $(kubectl get pods | grep -oP'mag [^ \\ s] +')-/ bin / bash
这对我有用
kubectl exec -it $(kubectl get pods| grep -oP 'mag[^\s]+') --container magname -- /bin/bash
这里的magname是实际的pod名称
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.