README.adoc 4.6 KB

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