Files
container.training/slides/k8s/metrics-server.md
Bridget Kromhout b92da2cf9f Update metrics-server.md
Small details
2019-04-20 12:37:37 -05:00

1.8 KiB

Checking pod and node resource usage

  • Since Kubernetes 1.8, metrics are collected by the core metrics pipeline

  • The core metrics pipeline is:

    • optional (Kubernetes can function without it)

    • necessary for some features (like the Horizontal Pod Autoscaler)

    • exposed through the Kubernetes API using the aggregation layer

    • usually implemented by the "metrics server"


How to know if the metrics server is running?

  • The easiest way to know is to run kubectl top

.exercise[

  • Check if the core metrics pipeline is available:
    kubectl top nodes
    

]

If it shows our nodes and their CPU and memory load, we're good!


Installing metrics server

  • The metrics server doesn't have any particular requirements

    (it doesn't need persistence, as it doesn't store metrics)

  • It has its own repository, kubernetes-incubator/metrics-server

  • The repository comes with YAML files for deployment

  • These files may not work on some clusters

    (e.g. if your node names are not in DNS)

  • The container.training repository has a metrics-server.yaml file to help with that

    (we can kubectl apply -f that file if needed)


Showing container resource usage

  • Once the metrics server is running, we can check container resource usage

.exercise[

  • Show resource usage across all containers:
    kuebectl top pods --containers --all-namespaces
    

]

  • We can also use selectors (-l app=...)