I'm trying to start a process using exec and redirect the stdout and stderr to a file in the container. I have a single container in a pod. I've tried the following combinations, but none see to work as expected. Is there any other way to achieve this behavior?
kubectl -n kube-system exec -it <pod-name> -- nohup sh -c '<process-command-with-args> &' > <log-file>
------->> -bash: <log-file>: Permission denied // It's trying to redirect the output to the host file
kubectl -n kube-system exec -it <pod-name> -- nohup sh -c '<process-command-with-args> > <log-file> &'
This command starts the process in the background but redirects the logs to nohup.out file instead of the log-file specified.
In general is there a way to execute multiple command line features like redirection and pipes in the container?
Thanks,
Divya
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
Yes, I was working around this with a script inside the container and yes it's a dirty solution for now. Looking for better solutions.
Could you explain what you mean by escaping it for host skipping redirection?