Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one pipe stdin into a container in a pod in Kuberentes?

I have a kubernetes cluster running on coreos. I wish to run journal2gelf https://github.com/systemd/journal2gelf in a container in a pod I call logging. (I also have a fluentd container in this pod, which works great, I highly recommend it for streaming logs elsewhere). Is it possible to configure a pod to allow essentially this:

journalctl -o json -f | docker run <my journal2gelf image> -d -p $GRAYLOG_PORT

but within the containers: key in a replication controller config? And in general can kubernetes allow piping to a container?

like image 659
Christian Grabowski Avatar asked Sep 11 '15 21:09

Christian Grabowski


People also ask

How can containers within a pod communicate with each other?

Within a Pod, containers share an IP address and port space, and can find each other via localhost . The containers in a Pod can also communicate with each other using standard inter-process communications like SystemV semaphores or POSIX shared memory.

Can 2 pods communicate in Kubernetes?

Kubernetes assumes that pods can communicate with other pods, regardless of which host they land on. Kubernetes gives every pod its own cluster-private IP address, so you do not need to explicitly create links between pods or map container ports to host ports.

How containers communicate with each other in Kubernetes?

Containers in a Pod share the same IPC namespace, which means they can also communicate with each other using standard inter-process communications such as SystemV semaphores or POSIX shared memory. Containers use the strategy of the localhost hostname for communication within a Pod.


1 Answers

This will let you send stdin to a container:

kubectl exec -i POD_NAME COMMAND

Or

kubectl attach -i POD_NAME

But there isn't a good way to define to stdin sent to all containers in a pod, or all containers spawned by a replication controller

like image 92
Jordan Liggitt Avatar answered Sep 30 '22 01:09

Jordan Liggitt