Welcome to the OpenTelemetry metrics on Kubernetes tutorial! This tutorial is continuation of KubeCon EU 2023 OpenTelemetry on Kubernetes tutorial. Today we will focus on collecting metrics on Kubernetes with OpenTelemetry. We will use OpenTelemetry API/SDK, collector, operator and auto-instrumentation libraries.
See the agenda
Almost all the following steps in this tutorial require kubectl. Your used version should not differ more than +-1 from the used cluster version. Please follow this installation guide.
If go is installed on your machine, kind can be easily installed as follows:
go install sigs.k8s.io/kind@v0.18.0If this is not the case, simply download the kind-v0.20.0 binary from the release page. (Other versions will probably work too. 🤠)
After a successful installation, a cluster can be created as follows:
kind create cluster --name=workshop --image kindest/node:v1.27.3Kind automatically sets the kube context to the created workshop cluster. We can easily check this by getting information about our nodes.
kubectl get nodesExpected is the following:
NAME STATUS ROLES AGE VERSION
workshop-control-plane Ready control-plane 75s v1.27.3kind delete cluster --name=workshopcert-manager is used by OpenTelemetry operator to provision TLS certificates for admission webhooks.
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yamlkubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yamlThis course is all about Observabilty, so a backend is needed. If you don't have one, you can install Prometheus for metrics and Jaeger for traces as follows:
kubectl apply -f https://raw.githubusercontent.com/pavolloffay/kubecon-na-2023-opentelemetry-kubernetes-metrics-tutorial/main/backend/01-backend.yamlAfterwards, the backend can be found in the namespace observability-backend. A grafana dashboard with preconfigured datasources and dashboard is available for visualisation and can be made accessible with port-fowarding.
kubectl port-forward -n observability-backend svc/grafana 3000:3000Open it in the browser localhost:3000