README.adoc 4.4 KB

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