table of Contents
Resource constraints container
service quality
requests (resource needs, a guaranteed minimum):
limits (resource limit, hard limit):
CPU: refers to the CPU thread, a thread 1000m
RAM
QoS Class: automatically generated
Guranteed (high priority)
CPU and memory while setting the request and limits
CPU.limits=CPU.request
memory.limits=CPU.request
Burstable (in priority)
At least one container disposed request CPU or memory of the
BestEffort (low priority)
No request a container is provided and limits
When the server's resources are not enough
- Priority will kill low priority container.
- According to demand, taking a high ratio of killed.
HeapSter + InfluxDB + Grafana (applies to versions prior to 1.10, has not recommended)
Resource usage data collection tools
- cAdvisor: Integration with kunelet, collecting node pod dosage level
- HeapSter: collect aggregate data
- InfluxDB: persistent data
- Grafana: Display Data
https://github.com/huruizhi/kubeasz/blob/master/docs/guide/heapster.md
API resource indicators and custom indicators API
- Resources index
- Custom Indicators
Next-generation architecture
Core Indicators pipeline: api kubelet metric-server and API Server provides; monitoring of accumulated CPU usage, memory usage in real time, resource usage, disk usage and node of the Pod.
Pipeline monitoring: indicators data from the phone system available to end users, the storage system and HPA, non-core indicators can not be resolved k8s.
metric-server
Resources index
kube-aggregator as a proxy to access core indicators point to apiserver, the user-defined indicators point metric-server
prometheus + k8s-prometheus-adapter
Custom Indicators
https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/prometheus
Note: The recommended helm installation deployment prometues
HPA apply autostretch
kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS
[--cpu-percent=CPU] [options]
kubectl explain hpa.spec.scaleTargetRef