README.adoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. = Linux Metrics Exporter for OpenShift Nodes =
  2. == Components ==
  3. . Container Image for SAR
  4. . Container Image for PSACCT
  5. . Container Image for Exporter
  6. == Deployment ==
  7. TBD
  8. == Images ==
  9. This set of images requires a valid entitlement for RHEL (and consequently
  10. either a RHEL system to build on or a RHEL system to create an entitlement
  11. secret from).
  12. NOTE: The entitled system architecture needs to match the container host!
  13. === Building with Podman ===
  14. If building the images using `podman` on an entitled host, no extra steps need
  15. to be performed as host entitlements will automatically be imported into the
  16. build container.
  17. NOTE: When building for an architecture without the `ubi-minimal` image or on a
  18. host that can not be entitled (f.e. Fedora CoreOS), you can choose a
  19. different base image by using the `--from` option in `podman build`:
  20. +
  21. [subs=+quotes]
  22. -------------------------------
  23. $ *podman build --from=registry.fedoraproject.org/fedora-minimal:36 -f ./images/Containerfile-sysstat -t collector-sysstat:latest*
  24. -------------------------------
  25. === Building in OpenShift ===
  26. If building the images in OpenShift Container Platform, you must make sure an
  27. entitlement secret and corresponding RHSM certificate secret are mounted inside
  28. the build pod in order for packages to be found and installed.
  29. The process is as follows.
  30. .Verify access to host entitlement data.
  31. [subs=+quotes]
  32. -------------------------------
  33. $ **ls -l /etc/pki/entitlement/*.pem /etc/rhsm/ca/*.pem**
  34. -rw-r--r--. 1 root root 3272 Oct 31 06:09 /etc/pki/entitlement/_6028779042203586857_-key.pem
  35. -rw-r--r--. 1 root root 149007 Oct 31 06:09 /etc/pki/entitlement/_6028779042203586857_.pem
  36. -rw-r--r--. 1 root root 2305 Sep 2 2021 /etc/rhsm/ca/redhat-entitlement-authority.pem
  37. -rw-r--r--. 1 root root 7411 Sep 2 2021 /etc/rhsm/ca/redhat-uep.pem
  38. -------------------------------
  39. .Create corresponding secrets.
  40. [subs=+quotes]
  41. -------------------------------
  42. $ *oc create secret generic etc-pki-entitlement \*
  43. *--from-file=/etc/pki/entitlement/_6028779042203586857_-key.pem \*
  44. *--from-file=/etc/pki/entitlement/_6028779042203586857_.pem*
  45. secret/etc-pki-entitlement created
  46. $ *oc create secret generic rhsm-ca \*
  47. *--from-file=/etc/rhsm/ca/redhat-entitlement-authority.pem \*
  48. *--from-file=/etc/rhsm/ca/redhat-uep.pem*
  49. secret/rhsm-ca created
  50. -------------------------------
  51. .Make sure the BuildConfig mounts those secrets.
  52. [subs=+quotes]
  53. -------------------------------
  54. apiVersion: build.openshift.io/v1
  55. kind: BuildConfig
  56. ...
  57. strategy:
  58. type: Docker
  59. dockerStrategy:
  60. dockerfilePath: Containerfile-psacct
  61. from:
  62. kind: ImageStreamTag
  63. name: ubi-minimal:latest
  64. **volumes:
  65. - source:
  66. type: Secret
  67. secret:
  68. secretName: etc-pki-entitlement
  69. name: etc-pki-entitlement
  70. mounts:
  71. - destinationPath: /etc/pki/entitlement
  72. - source:
  73. type: Secret
  74. secret:
  75. secretName: rhsm-ca
  76. name: rhsm-ca
  77. mounts:
  78. - destinationPath: /etc/rhsm/ca**
  79. -------------------------------
  80. `Containerfile` instructions are written such that they should work without
  81. modification regardless of whether the build is running in `podman` on an
  82. entitled host or inside a correctly configured OpenShift builder pod.
  83. NOTE: Key thing in `Containerfile` steps is to remove `/etc/rhsm-host` at some
  84. point unless `/etc/pki/entitlement-host` contains something (such as for
  85. example, valid entitlemets). Both are symlinks to `/run/secrets`.
  86. === SAR ===
  87. Sar image is based on `ubi-minimal` and includes just the `sysstat` package.
  88. It expects a volume to be attached at `/var/log/sa`.
  89. Entrypoint takes care of initialising the volume and rotating any old `sar` files out of the way.
  90. It *requires* to be executed under `root` UID.
  91. It also *requires* access to host's network namespace if you want to measure network statistics.
  92. === PSACCT ===
  93. Sar image is based on `ubi-minimal` and includes just the `psacct` package.
  94. It expects a volume to be attached at `/var/account`.
  95. Entrypoint takes care of initialising the volume and rotating any old `pacct` files out of the way.
  96. In addition to *requiring* execution under `root` UID, it also *requires* the `SYS_PACCT` capability.
  97. It also *requires* access to host's PID namespace (`--pid=host` podman option).
  98. === Exporter ===
  99. TBD