本文档采用自动化机器翻译技术翻译。 尽管我们力求提供准确的译文,但不对翻译内容的完整性、准确性或可靠性作出任何保证。 若出现任何内容不一致情况,请以原始 英文 版本为准,且原始英文版本为权威文本。

关于 rancher-selinux

为了让 Rancher 与 SELinux 一起工作,必须手动为 SELinux 节点启用某些功能。为此,Rancher 提供了一个 SELinux RPM。

rancher-selinux RPM 包含一组 SELinux 策略,旨在授予在启用 SELinux 的 Linux 系统上运行的各种 Rancher 组件所需的权限。

rancher-selinux 的 GitHub 储存库在 这里。

安装 rancher-selinux RPM

要求:

rancher-selinux RPM 在 openSUSE Tumbleweed 和基于 RHEL 的发行版(包括 Centos/RockyLinux 8 和 9)上进行了测试。

1.设置 yum 储存库

设置 yum 储存库以便在集群中的所有主机上直接安装 rancher-selinux

为了使用 RPM 储存库,在 CentOS 8 或 RHEL 8 系统上,运行以下 bash 代码片段:

# cat << EOF > /etc/yum.repos.d/rancher.repo
[rancher]
name=Rancher
baseurl=https://rpm.rancher.io/rancher/production/centos/8/noarch
enabled=1
gpgcheck=1
gpgkey=https://rpm.rancher.io/public.key
EOF

为了使用 RPM 储存库,在 CentOS 9 或 RHEL 9 系统上,运行以下 bash 代码片段:

# cat << EOF > /etc/yum.repos.d/rancher.repo
[rancher]
name=Rancher
baseurl=https://rpm.rancher.io/rancher/production/centos/9/noarch
enabled=1
gpgcheck=1
gpgkey=https://rpm.rancher.io/public.key
EOF

2.安装 RPM

安装 RPM:

yum -y install rancher-selinux

配置日志记录和监控应用程序以与 SELinux 一起使用

要求:

日志 v2 和监控 v2 在 RHEL/CentOS 8、9 和 Tumbleweed 上与 SELinux 进行了测试。

一旦在主机上安装了 rancher-selinux RPM,应用程序不会自动运行。它们需要配置为在 RPM 提供的允许的 SELinux 容器域中运行。

要使 rancher-loggingrancher-monitoring 图表支持 SELinux,请在安装图表时将 global.seLinux.enabled 更改为 true。