-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in phstsai/node-exporter-readme (pull request #3)
Phstsai/node exporter readme Approved-by: Che Wei Lin <[email protected]> Approved-by: Hung-Wei Chiu <[email protected]>
- Loading branch information
Showing
4 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Monitoring | ||
|
||
## Prometheus | ||
Prometheus is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true. | ||
|
||
### Create a monitoring namespace | ||
|
||
``` bash | ||
kubectl create -f monitoring-namespace.yaml | ||
``` | ||
|
||
### ConfigMap for Prometheus | ||
It collects metrics from ```kubernetes-apiservers```, ```kubernetes-cadvisor```, ```kubernetes-nodes```, ```kubernetes-pods```(every node-exporter), ```kubernetes-service-endpoints``` by default. | ||
|
||
``` bash | ||
kubectl create -f prometheus-config.yaml | ||
``` | ||
|
||
### Create the deployment and service | ||
|
||
``` bash | ||
kubectl create -f prometheus-deployment.yaml | ||
kubectl create -f prometheus-svc.yaml | ||
``` | ||
|
||
### Use the Prometheus | ||
Open the browser and connect to ```hostIP:30003```, you can see whether the Prometheus collect the metrics from targets correctly in ```Status->Targets```. | ||
|
||
You also can enter a PromQL expression to query the data and show them in graph. | ||
|
||
``` SQL | ||
sum by(pod_name)(container_memory_usage_bytes{namespace="kube-system"}) | ||
``` | ||
|
||
Or pass the expression through url and get the json. | ||
``` bash | ||
http://hostIP:30003/api/v1/query?query=sum%20by(pod_name)(container_memory_usage_bytes%7Bnamespace%3D%22kube-system%22%7D) | ||
``` | ||
|
||
|
||
## Node Exporter | ||
|
||
Node exporter for machine metrics, written in Go with pluggable metric collectors. | ||
|
||
### Create the node-exporter daemonset | ||
|
||
``` bash | ||
kubectl create -f node-exporter.yaml | ||
``` | ||
|
||
If you want to check whether the daemonset is created successfully, you can create a service to expose the node-exporter. | ||
|
||
``` bash | ||
kubectl create -f node-exporter-svc.yaml | ||
``` | ||
|
||
Open the browser and connect to ```hostIP:30910/metrics```, you can see the metrics of the host node (service will route the request to the pod in round robin order). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
namespace: monitoring | ||
name: node-exporter | ||
labels: | ||
app: node-exporter | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 9100 | ||
nodePort: 30910 | ||
selector: | ||
name: node-exporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.