I have a secret stored in the Kubernetes pod which can be accessible by the following command.
kubectl exec -it pod_name -- printenv | grep SFTP_PASSWORD
which will provide the output as
SFTP_PASSWORD=password
I am accessing this secret in the bash script.
sftp_password=$(kubectl exec -it pod_name -- printenv | grep SFTP_PASSWORD)
But the issue I am facing is the above command will return both key-value pairs instead of value.
echo "SFTP_PASSWORD=password" | sed 's/^SFTP_PASSWORD=//'