Skip to main content
InterviewHubPRO
Section Overview
Q34

Question 34 of 50

Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)

68%
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:

  • ServiceMonitor CRD (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/pods and standard OTLP gRPC endpoints.