Modify debug collectl config deployed in Openshift 4

Solution Verified - Updated

Environment

  • OpenShift Container Platform 4

Issue

Resolution

This assumes that you have already deployed collectl following sets in solution https://access.redhat.com/solutions/6989124

  1. Create collectl.conf with 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
    
  2. 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
    
  3. Create a configMap now with the file collectl.conf:

     $ oc create configmap collectl-conf --from-file collectl.conf
     configmap/collectl-conf created
    
  4. Create the a new file collectl-daemonset.yaml with 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
    
  5. Replace the existing DaemonSet with the modified Daemonset containing configmap reference.

     $ oc replace -f collectl-daemonset.yaml
    
  6. 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
    
  7. 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
    
SBR
Components
Category

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.