174 lines
4.1 KiB
YAML
174 lines
4.1 KiB
YAML
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: exa-csi-metrics-sa
|
|
namespace: default
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: metrics-reader
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["persistentvolumes", "persistentvolumeclaims", "nodes", "pods"]
|
|
verbs: ["get", "list"]
|
|
- apiGroups: ["storage.k8s.io"]
|
|
resources: ["storageclasses"]
|
|
verbs: ["get", "list", "watch"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: metrics-reader-binding
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: exa-csi-metrics-sa
|
|
namespace: default
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: metrics-reader
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: exa-csi-leader-election
|
|
namespace: default
|
|
rules:
|
|
- apiGroups: ["coordination.k8s.io"]
|
|
resources: ["leases"]
|
|
verbs: ["get", "watch", "list", "create", "update", "patch"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: exa-csi-leader-election
|
|
namespace: default
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: exa-csi-leader-election
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: exa-csi-metrics-sa
|
|
namespace: default
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: DaemonSet
|
|
metadata:
|
|
name: exa-csi-metrics-exporter
|
|
namespace: default
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: exa-csi-metrics-exporter
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: exa-csi-metrics-exporter
|
|
spec:
|
|
# affinity:
|
|
# nodeAffinity:
|
|
# requiredDuringSchedulingIgnoredDuringExecution:
|
|
# nodeSelectorTerms:
|
|
# - matchExpressions:
|
|
# - key: kubernetes.io/hostname
|
|
# operator: NotIn
|
|
# values:
|
|
# - nd-worker-2
|
|
serviceAccountName: exa-csi-metrics-sa
|
|
automountServiceAccountToken: true # Ensure token is mounted
|
|
containers:
|
|
- name: exporter
|
|
imagePullPolicy: Always
|
|
image: quay.io/ddn/exa-csi-metrics-exporter:v2.3.5
|
|
securityContext:
|
|
privileged: true
|
|
capabilities:
|
|
add: ['SYS_ADMIN']
|
|
allowPrivilegeEscalation: true
|
|
ports:
|
|
- containerPort: 9200
|
|
name: http
|
|
# hostPort: 32666
|
|
env:
|
|
- name: NODE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
- name: PORT
|
|
value: "9200"
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: COLLECT_INTERVAL
|
|
value: "30"
|
|
- name: LOG_LEVEL
|
|
value: "debug"
|
|
volumeMounts:
|
|
- name: secret
|
|
mountPath: /config
|
|
readOnly: true
|
|
- name: ca-certificates
|
|
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
|
readOnly: true
|
|
- name: host
|
|
mountPath: /host
|
|
mountPropagation: Bidirectional
|
|
volumes:
|
|
- name: secret
|
|
secret:
|
|
secretName: exascaler-csi-file-driver-config
|
|
- name: host
|
|
hostPath:
|
|
path: /
|
|
type: Directory
|
|
- name: ca-certificates
|
|
projected:
|
|
sources:
|
|
- serviceAccountToken:
|
|
path: token
|
|
expirationSeconds: 3600
|
|
- configMap:
|
|
name: kube-root-ca.crt # Mount CA cert
|
|
items:
|
|
- key: ca.crt
|
|
path: ca.crt
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: exa-csi-metrics-exporter
|
|
namespace: default
|
|
labels:
|
|
app: exa-csi-metrics-exporter
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9200"
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- port: 9200
|
|
targetPort: http
|
|
protocol: TCP
|
|
name: http
|
|
selector:
|
|
app: exa-csi-metrics-exporter
|
|
---
|
|
apiVersion: coordination.k8s.io/v1
|
|
kind: Lease
|
|
metadata:
|
|
name: exa-csi-metrics-exporter-leader-election
|
|
namespace: default
|
|
spec:
|
|
holderIdentity: ""
|
|
leaseDurationSeconds: 15
|
|
renewTime: null
|
|
acquireTime: null
|
|
leaseTransitions: 0
|