Kubernetes (K8s) (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Observability: Prometheus Pull Model, ServiceMonitors, and OpenTelemetry in K8s.
senior LevelCode ExampleSecurity & AuthKubernetes
In Simple Words: Monitoring microservices in dynamic Kubernetes environments:
ServiceMonitorCRD (Prometheus Operator):- Eliminates hardcoded scrape endpoints in Prometheus config.
- Automatically discovers pods and scrapes metrics based on Kubernetes service labels:
yaml
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: order-service-metrics spec: selector: matchLabels: app: order-service endpoints: - port: http-metrics interval: 15s
- OpenTelemetry Collector DaemonSet: Captures traces and logs from container runtimes via
/var/log/podsand standard OTLP gRPC endpoints.