Skip to content

Commit 80d5b7f

Browse files
committed
docs: add kubernetes reporter daemonset
1 parent b1df0d8 commit 80d5b7f

4 files changed

Lines changed: 92 additions & 0 deletions

File tree

docker/k8s/reporter-daemonset.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: tianji-reporter
5+
labels:
6+
app: tianji-reporter
7+
spec:
8+
selector:
9+
matchLabels:
10+
app: tianji-reporter
11+
template:
12+
metadata:
13+
labels:
14+
app: tianji-reporter
15+
spec:
16+
containers:
17+
- name: reporter
18+
image: moonrailgun/tianji:latest
19+
args:
20+
- /usr/local/bin/tianji-reporter
21+
- --url=$(TIANJI_SERVER_URL)
22+
- --workspace=$(TIANJI_WORKSPACE_ID)
23+
- --name=$(NODE_NAME)
24+
env:
25+
- name: NODE_NAME
26+
valueFrom:
27+
fieldRef:
28+
fieldPath: spec.nodeName
29+
- name: TIANJI_SERVER_URL
30+
value: "http://tianji.example.com"
31+
- name: TIANJI_WORKSPACE_ID
32+
value: "<your_workspace_id>"
33+
volumeMounts:
34+
- name: proc
35+
mountPath: /proc
36+
readOnly: true
37+
- name: sys
38+
mountPath: /sys
39+
readOnly: true
40+
- name: rootfs
41+
mountPath: /rootfs
42+
readOnly: true
43+
securityContext:
44+
privileged: true
45+
hostNetwork: true
46+
hostPID: true
47+
volumes:
48+
- name: proc
49+
hostPath:
50+
path: /proc
51+
- name: sys
52+
hostPath:
53+
path: /sys
54+
- name: rootfs
55+
hostPath:
56+
path: /
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Kubernetes",
3+
"position": 10
4+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Deploy Reporter as DaemonSet
6+
7+
If you are running Tianji inside Kubernetes, you may want to collect each node's
8+
system metrics. The easiest way is to run `tianji-reporter` as a DaemonSet so it
9+
runs on every node.
10+
11+
1. Edit `docker/k8s/reporter-daemonset.yaml` and replace the `TIANJI_SERVER_URL` and `TIANJI_WORKSPACE_ID` values with your actual server address and workspace ID.
12+
2. Apply the manifest:
13+
14+
```bash
15+
kubectl apply -f docker/k8s/reporter-daemonset.yaml
16+
```
17+
18+
Every node will start a `tianji-reporter` container which reports system
19+
statistics to your Tianji instance. You can check the logs of a specific pod to
20+
ensure it works:
21+
22+
```bash
23+
kubectl logs -l app=tianji-reporter -f
24+
```
25+
26+
Once the pods are running, the **Servers** page in Tianji will list your
27+
Kubernetes nodes just like regular machines.

website/docs/server-status/server-status-reporter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ curl -o- https://tianji.example.com/serverStatus/xxxxxxxxxxxxxxxxxxx/install.sh?
4545

4646
The main change is to append `-s uninstall` to your install command.
4747

48+
## Kubernetes
49+
50+
If your servers are running in a Kubernetes cluster, you can deploy the reporter as a DaemonSet so each node reports metrics automatically. See [Deploy Reporter as DaemonSet](./kubernetes/reporter-daemonset.md) for details.
51+
52+
4853
## Q&A
4954

5055
### How to check tianji reporter service log?

0 commit comments

Comments
 (0)