Skip to content

Latest commit

 

History

History

operator

Tailing sidecar operator

Tailing sidecar operator automatically adds streaming sidecar containers which use tailing sidecar image to Pods based on configuration provided in annotation.

Configuration for tailing sidecar operator is described here.

To quickly see benefits of using tailing sidecar operator try it in prepared Vagrant environment.

Deploy tailing sidecar operator

Prerequisities

Set images (optional)

Set tailing sidecar image:

export TAILING_SIDECAR_IMG="<some-registry>/<project-name>:tag"
sed -i.backup "s#sumologic/tailing-sidecar:latest#${TAILING_SIDECAR_IMG}#g" config/default/manager_patch.yaml

Set tailing-sidecar operator image:

export TAILING_SIDECAR_OPERATOR_IMG="<some-registry>/<project-name>:tag"
(cd config/manager && kustomize edit set image controller="${TAILING_SIDECAR_OPERATOR_IMG}")

Deploy operator

kustomize build config/default | kubectl apply -f -

Test operator

Add annotation to Pod in following form:

metadata:
  annotations:
    tailing-sidecar: <sidecar-name-0>:<volume-name-0>:<path-to-tail-0>;<sidecar-name-1>:<volume-name-1>:<path-to-tail-1>

to learn more about configuration see this.

Deploy Pod with tailing-sidecar annotation e.g.

kubectl apply -f examples/pod_with_annotations.yaml

Check logs from tailing sidecar e.g.

kubectl logs pod-with-annotations tailing-sidecar-0  --tail 5 -n tailing-sidecar-system

Build and push tailing sidecar operator image to container registry

To build tailing sidecar operator image:

make docker-build IMG="<some-registry>/<project-name>:tag"

To push tailing sidecar operator image to container registry:

make docker-push IMG="<some-registry>/<project-name>:tag"

Testing in Vagrant environment

Start and provision the Vagrant environment:

vagrant up

Connect to virtual machine:

vagrant ssh

Build and push tailing sidecar image to local container registry:

/tailing-sidecasidecar/fluentbit/akefile

Go to operator directory:

cd /tailing-sidecar/operator

Deploy operator:

make

Deploy examples:

make deploy-examples

Check that operator added tailing sidecars to example resources:

make check-examples