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/[email protected]
If 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.3
Kind automatically sets the kube context to the created workshop cluster. We can easily check this by getting information about our nodes.
kubectl get nodes
Expected is the following:
NAME STATUS ROLES AGE VERSION
workshop-control-plane Ready control-plane 75s v1.27.3
kind delete cluster --name=workshop
cert-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.yaml
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.88.0/opentelemetry-operator.yaml
This 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.yaml
Afterwards, 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:3000
Open it in the browser localhost:3000