I have a shell script scheduled with a cronjob in my linux machine. The script has a kubectl command which sets the context and scaleup services based on a previous version file.
kubectl config set-context <AWSClusterARN> --namespace=<name>
kubectl get deploy --no-headers -n name | grep '^svc1\|^svc2' | awk '{print $1, $4}' > deploy_state_before_scale.txt
I have the output of the shell directed to a log file. When I checked it today, it shows
/path/filename.sh: line 19: kubectl: command not found
/path/filename.sh: line 21: kubectl: command not found
/path/filename.sh: line 23: kubectl: command not found
But when I run the file manually as ./filename.sh, the commands get executed.
Context "<AWSClusterARN>" modified.
Scaling down svc1
deployment.apps/svc1 scaled