我尝试执行以下命令:
alias kubectl_winpty='winpty kubectl' ( using winpty due to [bug][1]
kubectl_winpty exec -it vault-0 -n vault-xxx -- sh export VAULT_CACERT=/vault/userconfig/vault-tls/vault.ca但是我得到了这个错误:
sh: can't open 'export': No such file or directory
command terminated with exit code 2pod确实存在且正在运行
$ kubectl get pods vault-0 -n vault-xxx
NAME READY STATUS RESTARTS AGE
vault-0 0/1 Running 0 17m发布于 2021-01-23 18:18:02
我猜sh export使shell假定导出为一个文件名( shell将运行的一些脚本)。因此出现了错误can't open 'export': No such file or directory。
尝试使用-c选项。
kubectl_winpty exec -it vault-0 -n vault-xxx -- sh -c "export VAULT_CACERT=/vault/userconfig/vault-tls/vault.ca"另外,最好使用set env variable when you create this pod。
还要确保your pod is healthy and in ready state,这不是根据kubectl get输出的情况。
https://stackoverflow.com/questions/65857913
复制相似问题