在后台启用端口转发后缺少其他命令



简单地说,我已经创建了一个Kubernetes服务,现在我已经创建一个shell脚本来检查curl的输出。端口转发后,它不会显示回显命令输出。有什么不见了,我在这里很困惑。

hello_call() {
if kubectl config get-contexts; then
echo "Listing ALL available contexts....................."
else
echo "Getting contexts failed....."
fi
if kubectl config use-context example; then
echo "Switching to context example"
else
echo "Failed to Switch to context example"
fi
if kubectl get svc,pods -n hello; then
echo "Listening all services and pods.........."
else
echo "Failed to Listing"
fi
echo "#############Checking HTTP service call #####################"
POD_NAME=$(kubectl --namespace hello get pods -l "app=hello,release=hello" -o jsonpath="{.items[0].metadata.name}")
PORT_FORWARD=$(kubectl --namespace hello port-forward $POD_NAME 8071:8093 >/dev/null 2>&1 &)
echo "Enabling Port forwarding to execute from local ${PORT_FORWARD}"
sleep 5
echo ################# Dev Call ############
curl http://127.0.0.1:8071/hello -H 'dev: hello'
}

echo命令中缺少"

echo "################# Dev Call ############"

最新更新