We use systemd in our container to manage the processes running in the container. We configure journald in the container so, that it sends all logs to /dev/console. In order to have /dev/console in a container we have to use "-t" option of Docker when we deploy the container.
I would like to ask, what the equivalent way is with Kubernetes. Where can we state in the pod manifest that we need /dev/console in the containers? I understand, that with kubectl it is possible (with "--tty" or "-t"). But we do not want to start containers with kubectl.
The kubectl --tty
option only applies to kubectl exec --tty
, which is for running a process inside a container that has already been deployed in a pod. So it would not help you deploy pods with /dev/console
defined.
As far as I can see there's no way in current Kubernetes to cause pods to be launched with containers having /dev/console
defined.
I would go further and say that the way these containers are defined, with multiple processes managed by systemd and logged by journald, is outside the usual use cases for Kubernetes. Kubernetes has value where the containers are simple, individual processes, running as daemons. Kubernetes manages the launching of multiple distict containers per pod, and/or multiple pods as replicas, including monitoring, logging, restart, etc. Having a separate launch/init and log scheme inside each container doesn't fit the usual Kubernetes use case.
We do support TTY containers in kubernetes v1.1, but not a tty without input. If you want to see that, I think a GitHub issue would be appropriate.
I agree with Spencer that running systemd in a container is not "best practice" but there are valid reasons to do it, not the least of which is "that's what we know how to do". People's usage of container will evolve over time.