Infrastructure/ Cluster components should be monitored separately from your applications. This allows you to "kill" the application Prometheus in case you have screwed up in some way (e.g., messed up application metrics causing to have a billion labeled metrics).
2379/TCP/metricskubectl create secret generic --from-file=.../ca.crt --from-file=.../monitoring.crt --from-file=.../monitoring.keymountPath.6443/TCP (depends on your installation)/metricshistogram_quantile() Prometheus func over some time.443/TCP (depends on your installation)/metrics:: (0.0.0.0) or have a proxy which is available to Prometheus for scraping running.scheduler_binding_*)443/TCP (depends on your installation)/metrics:: (0.0.0.0) or have a proxy which is available to Prometheus for scraping running.See Node Components - kubelet.
See Node Components - kube-proxy.
See Node Components - kube-proxy.
443/TCP (depends on your installation)/metrics--authorization-mode=Webhook and --authentication-token-webhook=true.kubelet_node_config_error good to know if the latest config works.histogram_quantile()).10250/TCP (depends on your installation)/metricsiptables and/ or ipvs sync information (~= how long does it take for Service changes to be reflected in the "routing" rules).Depends on the SDN/ CNI used, if there are metrics available. Calico for example can expose metrics, but that must be enabled through a environemnt variable on the Calico Node DaemonSet.
For other SDNs, e.g., OpenVSwitch you may need to use an "external" exporter when available:
See Monitoring/Prometheus/Exporters - node_exporter.
See Monitoring/Prometheus/Exporters - ethtool_exporter.
Other components that are in and/ or around a Kubernetes cluster.
(More information https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/)
443/TCP/metrics8080/TCP for "cluster" metrics and 8081/TCP for kube-state-metrics metrics. (Recommended to scrape both)/metricsStatus (that is in the official Kubernetes APIs).Elasticsearch is not providing Prometheus metrics itself, but there is a well written exporter GitHub justwatchcom/elasticsearch_exporter. (There are some other exporters also available, though I have used mainly used this one for the amount of metrics I'm able to get from Elasticsearch with it)
9114/TCP (depends on your installation)/metrics9090/TCP (depends on your installation)/metricsapiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus-infra
rules:
- apiGroups:
- ""
resources:
- nodes/metrics
verbs:
- get
- nonResourceURLs:
- /metrics
- /metrics/cadvisor
verbs:
- get
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus
namespace: YOUR_NAMESPACE
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
node-role.kubernetes.io/control-plane (old label node-role.kubernetes.io/master) label.
So be sure to have it set on the control plane nodes (e.g., kubeadm automatically sets it on control plane nodes).For more information see Kubernetes Cheat Sheet - Role Label for Node objects.I can only recommend you to use the Prometheus Community Helm Charts for this and checking out their documentation regarding the ETCD certificates/ credentials required for accessing the metrics.