Modify debug collectl config deployed in Openshift 4
Environment
- OpenShift Container Platform 4
Issue
- Add custom parameters to the collectl deployed following the solution https://access.redhat.com/solutions/6989124
Resolution
This assumes that you have already deployed collectl following sets in solution https://access.redhat.com/solutions/6989124
-
Create
collectl.confwith the following content:DaemonCommands = -f /var/log/collectl -r00:00,7 -m -F60 -s+YZ PQuery = /usr/sbin/perfquery:/usr/bin/perfquery:/usr/local/ofed/bin/perfquery PCounter = /usr/mellanox/bin/get_pcounter VStat = /usr/mellanox/bin/vstat:/usr/bin/vstat OfedInfo = /usr/bin/ofed_info:/usr/local/ofed/bin/ofed_info Resize=/usr/bin/resize:/usr/X11R6/bin/resize Ipmitool = /usr/bin/ipmitool:/usr/local/bin/ipmitool:/opt/hptc/sbin/ipmitool IpmiCache = /var/run/collectl-ipmicache IpmiTypes = fan,temp,current -
Add your custom configuration to collectl.conf
echo 'DiskFilter = /hd[ab] | sd[a-z]+ |dm-\d+ |xvd[a-z] |fio[a-z]+ | vd[a-z]+ |emcpower[a-z]+ |psv\d+ |nvme\d+n\d+ |rbd\d+ /' >> collectl.conf -
Create a
configMapnow with the filecollectl.conf:$ oc create configmap collectl-conf --from-file collectl.conf configmap/collectl-conf created -
Create the a new file
collectl-daemonset.yamlwith the following contents:.apiVersion: apps/v1 kind: DaemonSet metadata: name: collectl namespace: collectl labels: app: collectl spec: selector: matchLabels: app: collectl template: metadata: labels: app: collectl spec: # these toleration are to have the daemonset runnable on control plane nodes # Uncomment them if you want control plane nodes to run DS pods #tolerations: #- key: node-role.kubernetes.io/master # operator: Exists # effect: NoSchedule nodeSelector: collectl: "true" containers: - name: collectl image: quay.io/gmeghnag/collectl:4.3.20-ubi9 imagePullPolicy: Always resources: limits: memory: 400Mi requests: cpu: 100m memory: 400Mi volumeMounts: - mountPath: /dev/mem name: mem - mountPath: /sys name: sys - mountPath: /var/log name: logs - mountPath: /etc/collectl.conf name: conf subPath: collectl.conf securityContext: runAsUser: 0 privileged: true volumes: - name: mem hostPath: path: /dev/mem type: CharDevice - name: sys hostPath: path: /sys type: Directory - name: logs hostPath: path: /var/log type: Directory - name: conf configMap: name: collectl-conf hostPID: true hostNetwork: true hostIPC: true -
Replace the existing DaemonSet with the modified Daemonset containing configmap reference.
$ oc replace -f collectl-daemonset.yaml -
You should now see that collectl was redeployed and running on the node:
$ oc get pods NAME READY STATUS RESTARTS AGE collectl-entd4 1/1 Running 0 9s -
If more changes are needed to the collectl configmap just recreate the collectl.conf with changes and run the following to overwrite content.
$ oc create configmap collectl-conf --from-file collectl.conf --dry-run=client -o yaml | oc replace -f - $ oc delete pods -l app=collectl
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.