Command started multiple times and no logs

I can run this container on the same node, from the command line, and it works fine. But when I create the deployment with Kubernetes, the container “command” is run multiple time I don’t see any logs from the container. I checked this by logging into the node, and running sudo docker logs on the container and sudo docker exec ps -a. When I run the same container, on the same node, from the command line,the container “command” is only executed once and the logs are written properly, and the on container does the work it’s intended for.

In Rancher, the container reports a status of “Running”. Just no logs.

Here’s what ps -a shows:
PID USER TIME COMMAND
9 8 root S 1548 0% 0 0% {client-run-help} /bin/sh /bin/client-run-helper.sh
24 19 root R 1548 0% 0 0% top
1 0 root S 1544 0% 0 0% /bin/sh -c /bin/client-run-helper.sh 40.xxx.xxx.255 5001 00:12:34:56:00:01 SFC1-000001 10
8 1 root S 1544 0% 0 0% {client-run-help} /bin/sh /bin/client-run-helper.sh

here’s what is should look like (and how it looks when I run the container from CLI):

PID USER TIME COMMAND
1 root 0:00 {client-run-help} /bin/sh /bin/client-run-helper.sh 40.xxx.xxx.255 5001 00:12:34:56:00:01 SFC1-000001 10
16 root 0:00 ./test_client 40.xxx.xxx.255 5001 00:12:34:56:00:01 SFC1-000001 10
22 root 0:00 ps -a

From the command line, logs are issued normally, started with Rancher (kubernetes) no logs…none.

Please, advise.

Have you tried using:

kubectl --namespace default logs [CONTAINER_ID]

Don’t forget to look the the correct namespace.

To find the container Id use:

kubectl get pods --all-namespaces

And the container Id is the one under the “NAME” column.

Thanks for your reply. I can see the logs, if I start the container from the commandline. I can’t see them if I start it via kubectl create. The kubectl --namespace default logs simulator-oiuproiuy command just returns nothing.

Is it recreating the container over and over, resulting in running the container “command” multiple times?
Is the container supposed to run a one-time job and then complete?

What I really want is to create a Job. But since the Rancher UI only shows a deployment, I was trying to shoehorn my workload into a deployment. So yea,it may have been trying to run the container more than once…not sure why that would run the command more than once.

Running as a job didn’t help. I still see what appears to be multiple invocations, and no logs. The absence of logs is what bugs me most.

I had both a “command” and “args” element in the k8s yaml. Apparently this represented two things to run. Seems odd. Anyway, I put the command and all of it’s args in the command value, and it works fine.

K8s Command == Docker Entrypoint
K8s Args == Docker Command

thanks, that makes sense.