Mutating admission controller that injects initial trace id
and base64 encoded span context
into the trace.kubernetes.io.initial
and trace.kubernetes.io.span.context
object annotation.
First of all, we need a kubernetes(v1.18.5+) cluster, a single-node cluster will make the next job easier.
Use our kube-apiserver
and kube-controller-manger
instead of them in cluster:
- Clone the source code from here.
- Run
KUBE_BUILD_PLATFORMS=linux/amd64 KUBE_BUILD_CONFORMANCE=n KUBE_BUILD_HYPERKUBE=n make release-images
. - Run
docker load -i _output/release-images/amd64/kube-apiserver.tar
. - Run
docker load -i _output/release-images/amd64/kube-controller-manager.tar
. - Edit
/etc/kubernetes/manifests/kube-apiserver.yaml
, use ourkube-apiserver image
instead of old image. - Edit
/etc/kubernetes/manifests/kube-controller-manager.yaml
, use ourkube-controller-manager image
instead of old image.
The included Makefile
makes these steps straightforward and the available commands are as follows:
make build
: build execute file.make docker
: build and save Docker image.make install
: apply certificate configuration and deployment configuration to cluster for the mutating webhook.make remove
: delete resources associated with the mutating webhook from the active cluster.make deployment
: apply and delete a deployment.make deamonset
: apply and delete a deamonset.make statefulset
: apply and delete a statefulset.make replicaset
: apply and delete a replicaset.make pod
: apply and delete a pod.make clean
: remove files build by script.
We can check the logs of webhook to get the result of trace.
Currently, we support the following objects:
- Deployment
- DeamonSet
- StatefulSet
- ReplicaSet
- Pod
- Scale