It is not uncommon to see Kubernetes nodes are minimally configured. Both Red Hat Atomic and CoreOS only occupy small footprint. The idea is that utilities can be loaded and executed in containers.
So this is dilemma that Kubernetes has to deal with. As I am pumping more and more volume plugins, I am increasingly asking more packages (Ceph, Glusterfs, iSCSI, and Fibre Channel) to be available on the hosts.
So that where the Sidecar Pod solution comes to shine. A Sidecar Pod is a Pod that is created, tracked, and stopped by Kubelet, rather than API server. This Pod’s purpose is to encapsulate utilities that Kubelet needs to finish, for instance, creating volumes on the host. Sidecar Pod is created on the fly and silently exit without API server’s notice.
To demonstrate this Sidecar Pod usage, I created a Pod using rbd volume:
[root@host kubernetes]# ./cluster/kubectl.sh create -f sidecar.yaml replicationcontroller "web" created
I looked at the Pods immediately and found two Pods are created, the Pod rbd-sidecar-qdsl8 is created by kubelet.
[root@host kubernetes]# ./cluster/kubectl.sh get pod NAME READY STATUS RESTARTS AGE rbd-sidecar-qdsl8 0/1 Image: ceph/base is ready, container is creating 0 1s web-fm2hn 0/1 Pending 0 2s
After a while, the web Pod was created:
[root@host kubernetes]# ./cluster/kubectl.sh get pod NAME READY STATUS RESTARTS AGE web-fm2hn 1/1 Running 0 2m
To see what Sidecar Pod had done, on the Kubernetes node, I looked at the container history:
# docker ps -a |grep ceph |head 67e96093fed2 ceph/base "rbd lock add foo kub" 3 minutes ago Exited (0) 3 minutes ago k8s_rbd-sidecar.6f32a81f_rbd-sidecar-2t6yr_default_9fafe0cc-571d-11e5-a098-d4bed9b38fad_08ddc932 7ffb1e66580b ceph/base "rbd lock list foo --" 3 minutes ago Exited (0) 3 minutes ago k8s_rbd-sidecar.46639472_rbd-sidecar-a0gyc_default_9e5e658d-571d-11e5-a098-d4bed9b38fad_2c2a3b11 4843dae36466 ceph/base "rbd map foo --pool k" 3 minutes ago Exited (0) 3 minutes ago k8s_rbd-sidecar.60e6922b_rbd-sidecar-qdsl8_default_9d173a4d-571d-11e5-a098-d4bed9b38fad_0fcf4e57
So this just said my Sidecar container created rbd volumes.