Note that the probe command is executed directly, not in a shell, but you
are using a pipe. try this:

command:
- sh
- -ec
- ps -ef | grep my_process_name

aside from that - don't run multiple processes in a container; use multiple
containers in a pod instead. Make sure that when your process exits, the
main command does; the best way is to ensure that everything is exec'd
instead of running as subprocesses. Then, you don't need this probe as the
container runtime will know that your process is no longer running and will
restart it automatically.

/MR

On Thu, Jun 1, 2017, 21:41 Rodrigo Campos <rodr...@sdfg.com.ar> wrote:

> Did it worked? :)
>
> (note that both formats, Guangya Liu used and I, are valid in yaml for
> arrays,
> so both should be fine, choose the one you prefer).
>
> On Thu, Jun 01, 2017 at 07:42:07AM +0800, Guangya Liu wrote:
> > Yes, should use array, here is an example:
> >
> > ```
> >
> > livenessProbe:  exec:
> >     command:
> >     - cat
> >     - /tmp/healthy
> >
> > ```
> >
> > I think that you can probably run the case
> >
> https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
> > here first and then update the template step by step to fit your case.
> >
> > On Thu, Jun 1, 2017 at 7:38 AM, Rodrigo Campos <rodrig...@gmail.com>
> wrote:
> >
> > > You should use an array, like ["command", ... ], IIRC the syntax
> correctly
> > >
> > >
> > > On Wednesday, May 31, 2017, Sambit Mishra <sambitmishra...@gmail.com>
> > > wrote:
> > >
> > >> I have a process running inside an Ubuntu container and would like to
> > >> redeploy the container if the process gets killed. I added the
> following
> > >> liveness probe in container spec
> > >>  -livenessProbe:
> > >>    exec:
> > >>     command:
> > >>      - ps -ef | grep my_process_name
> > >>     initialDelaySeconds: 120
> > >>     periodSeconds: 30
> > >> However this doesnt work. When I do a kubectl describe pods I get the
> > >> following event.
> > >>
> > >> 1h 6m 20 {kubelet k8s-agent-71e8d996-0}
> spec.containers{my_process_name}
> > >> Warning Unhealthy Liveness probe failed: rpc error: code = 13 desc =
> > >> invalid header field value "oci runtime error: exec failed:
> > >> container_linux.go:247: starting container process caused \"exec:
> \\"ps -ef
> > >> | grep my_process_name\\": executable file not found in $PATH\"\n"
> > >>
> > >> And it keeps redeploying the container. If I bash into the container
> and
> > >> do a 'ps -ef' it works but this doesnt Whats a good way to use the
> liveness
> > >> probe to check if a process is running or not ?
> > >>
> > >> --
> > >> 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-users+unsubscr...@googlegroups.com.
> > >> To post to this group, send email to
> kubernetes-users@googlegroups.com.
> > >> Visit this group at https://groups.google.com/group/kubernetes-users.
> > >> For more options, visit https://groups.google.com/d/optout.
> > >>
> > > --
> > > 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-users+unsubscr...@googlegroups.com.
> > > To post to this group, send email to kubernetes-users@googlegroups.com
> .
> > > Visit this group at https://groups.google.com/group/kubernetes-users.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > 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-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to kubernetes-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/kubernetes-users.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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-users+unsubscr...@googlegroups.com.
> To post to this group, send email to kubernetes-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to