Skip to content

Commit

Permalink
Add service account so gpu-exporter can list pods (#27)
Browse files Browse the repository at this point in the history
In cases where the DCGM host address is not provided
gpu-metrics-exporter lists the pods with a specific
label. The default service accounts does not have
enough permissions to list the pods. A new ServiceAccount
and ClusterRole are created.
  • Loading branch information
atanasovskib authored Aug 1, 2024
1 parent 122c0f7 commit ce32713
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 0 additions & 2 deletions charts/gpu-metrics-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ spec:
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
tolerations:
- operator: "Exists"
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down
27 changes: 27 additions & 0 deletions charts/gpu-metrics-exporter/templates/service-acc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: gpu-exporter-sa
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: list-pods-clusterrole
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: list-pods-clusterrolebinding
subjects:
- kind: ServiceAccount
name: gpu-exporter-sa
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: list-pods-clusterrole
apiGroup: rbac.authorization.k8s.io
2 changes: 1 addition & 1 deletion charts/gpu-metrics-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ additionalVolumes: []
serviceAccount:
create: true
automount: true
annotations: { }
annotations: {}
gpuMetricsExporter:
image:
repository: ghcr.io/castai/gpu-metrics-exporter/gpu-metrics-exporter
Expand Down

0 comments on commit ce32713

Please sign in to comment.