Simply I have created one Kubernetes service and now I am created a shell script to check the output of curl. After port-forwarding it is not showing echo commands output. anything missing i is here confused on it.
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'
}
You are missing "
in echo command.
echo "################# Dev Call ############"