Skip to content

Commit 69b0199

Browse files
authored
document kube-state-metrics configuration (#251)
1 parent e467d1e commit 69b0199

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

kube-state-metrics/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
This directory contains configuration files for enabling
2+
[kube-state-metrics](https://github.com/kubernetes/kube-state-metrics/)
3+
to report metrics for AppWrappers.
4+
5+
The file [appwrapper-ksm-cm.yaml](./appwrapper-ksm-cm.yaml) defines
6+
a configuration map that can be volume-mounted into the
7+
kube-state-metrics pod and passed via the `--custom-resource-state-config-file`
8+
command line argument. For development of the AppWrapper metrics,
9+
you may want to add `--custom-resource-state-only=true` to the command
10+
line arguments to suppress generation of metrics for built-in types.
11+
12+
The file [appwrapper-ksm-rbac.yaml](./appwrapper-ksm-rbac.yaml) defines
13+
a clusterrole and clusterrolebinding that add the RBACs
14+
needed to collect AppWrapper metrics to the `kube-state-metrics` service account.
15+
Alternatively, you could edit the existing kube-state-metrics clusterrole to
16+
add these permissions.
17+
18+
The changes to the kube-state-metrics deployment are roughly as shown below:
19+
```yaml
20+
...
21+
spec:
22+
containers:
23+
- args:
24+
- --custom-resource-state-config-file=/appwrapper_ksm.yaml
25+
...
26+
volumeMounts:
27+
- mountPath: /appwrapper_ksm.yaml
28+
name: appwrapper-ksm
29+
readOnly: true
30+
subPath: appwrapper_ksm.yaml
31+
...
32+
volumes:
33+
- configMap:
34+
defaultMode: 420
35+
name: appwrapper-ksm
36+
name: appwrapper-ksm
37+
```
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: kube-state-metrics-appwrapper
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: kube-state-metrics-appwrapper
9+
subjects:
10+
- kind: ServiceAccount
11+
name: kube-state-metrics
12+
namespace: kube-system
13+
---
14+
apiVersion: rbac.authorization.k8s.io/v1
15+
kind: ClusterRole
16+
metadata:
17+
name: kube-state-metrics-appwrapper
18+
rules:
19+
- apiGroups:
20+
- apiextensions.k8s.io
21+
resources:
22+
- customresourcedefinitions
23+
verbs:
24+
- list
25+
- watch
26+
- apiGroups:
27+
- workload.codeflare.dev
28+
resources:
29+
- appwrappers
30+
verbs:
31+
- list
32+
- watch

0 commit comments

Comments
 (0)