我试图从shell脚本调用kubectl create -n $test_namespace -f <absolute-path-to-tea-rc-file>.yaml
。运行kubectl从shell脚本内部创建命令
#!/bin/bash
current_dir=$(pwd)
echo "current_dir is $current_dir"
parentdir="$(dirname "$current_dir")"
echo $parentdir
kubectl create -n $test_namespace -f $parentdir/deployment/common/tea-rc.yaml
它给误差如下:
Bhagyashrees-MacBook-Pro:execution_controller bhagyashree$ sh test.sh
current_dir is /Users/bhagyashree/Documents/FDrepo/armada-ingress-ctl-test/execution_controller
/Users/bhagyashree/Documents/FDrepo/armada-ingress-ctl-test
error: unknown command "/Users/bhagyashree/Documents/FDrepo/armada-ingress-ctl-test/deployment/common/tea-rc.yaml"
See 'kubectl create -h' for help and examples.
当它从一个终端执行相同的命令作品。 kubectl create -n testnamespace -f /Users/bhagyashree/Documents/FDrepo/armada-ingress-ctl-test/deployment/common/tea-rc.yaml
我在这里错过了什么?
是的。命名空间被传递为空白。一旦我设置了命名空间,我就可以用上面的语法创建资源。 谢谢!!! – Bhagyashree
我很高兴它的工作,你会介意把它作为正确的答案吗?谢谢。 –
完成。标记为正确答案。再次感谢@Simon – Bhagyashree