I am trying to write some conditional script to up my kubernetes system
#!/bin/sh
#checking if the namespace exists
export namespace="kube-system"
export mypassword="logan"
#installing json reader
echo mypassword | sudo apt-get install jq
echo mypassword | status=$(sudo kubectl get ns ${namespace} -o json | jq .status.phase -r)
echo "$status" #its not printing
if [ "$status" = "Active" ]
then
echo hi
else
echo bye
fi
But some how my status variable is not getting printed and neither the if else condition is working ,how to solve it ?Please help