On a machine with docker
already installed:
brew install kind kubernetes-cli helm
kind create cluster --config kind-1worker-config.yaml
kubectl config use-context kind-kind
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm install my-otel-demo open-telemetry/opentelemetry-demo
helm install --values values.agent.yaml agent open-telemetry/opentelemetry-collector
helm install --values values.gateway.yaml gateway open-telemetry/opentelemetry-collector
kubectl patch deployment/my-otel-demo-frontend --type json --patch-file patch-my-otel-demo-1.yaml
kubectl set env deployment/my-otel-demo-frontend OTEL_EXPORTER_OTLP_ENDPOINT='http://$(K8S_NODE_IP):4317
kubectl port-forward svc/my-otel-demo-frontend 8080:8080
kubectl logs -f deployment/gateway-opentelemetry-collector
-
Note: You may need to wait a while before step 9 to ensure all of the my-otel-demo deployments have succeeded.
-
Go to your browser and access
http://localhost:8080
-
Watch for the traces coming in, and note that the debug logs from
k8sattributesprocessor
indicates that it has matched the pod IP fromk8s.pod.ip
and is adding the requested attributes to the resource associated with the traces.
- Edit values.gateway.yaml and replace
image.tag
by "0.55.0" - Run
helm upgrade gateway --values values.gateway.yaml open-telemetry/opentelemetry-collector
- Run the same
kubectl logs -f deployment/gateway-opentelemetry-collector
and now note that the k8sattributesprocessor can no longer match the incoming pod IP specified ink8s.pod.ip