You are viewing documentation for a release that is no longer maintained. To view the documentation for the most recent version, see the latest RHACS docs.
2.3. 配置访问权限
Red Hat Advanced Cluster Security for Kubernetes 提供了一个命令行界面(CLI) roxctl
,以便可以轻松地将 Red Hat Advanced Cluster Security for Kubernetes 策略集成到构建管道中。roxctl
CLI 显示有关问题的详细信息以及如何修复它们,以便开发人员可以在容器生命周期的早期阶段维护高标准。
要安全地向 Red Hat Advanced Cluster Security for Kubernetes API 服务器进行身份验证,您必须创建一个 API 令牌。
2.3.1. 使用 roxctl CLI 进行身份验证 复制链接链接已复制到粘贴板!
要进行身份验证,您可以使用身份验证令牌或管理员密码。红帽建议在生产环境中使用身份验证令牌,因为每个令牌被分配了特定的访问控制权限。
使用以下步骤生成身份验证令牌。
流程
- 进入 RHACS 门户。
-
进入 Platform Configuration
Integrations。 - 向下滚动到 Authentication Tokens 类别,然后单击 API Token。
- 点 Generate Token。
- 为令牌输入一个名称,再选择提供所需访问级别的角色(例如,持续集成或 Sensor Creator )。
点 Generate。
重要复制生成的令牌,并安全地存储它。您将无法再次查看它。
生成身份验证令牌后,将其导出为 ROX_API_TOKEN
变量:
export ROX_API_TOKEN=<api_token>
$ export ROX_API_TOKEN=<api_token>
您还可以将令牌保存到文件中,并将它与 --token-file
选项一起使用。例如:
roxctl central debug dump --token-file <token_file>
$ roxctl central debug dump --token-file <token_file>
-
您不能同时使用
-password
(-p
)和--token-file
选项。 -
如果您已设置了
ROX_API_TOKEN
变量,并指定--token-file
选项,roxctl
CLI 使用指定的令牌文件进行身份验证。 -
如果您已设置了
ROX_API_TOKEN
变量,并指定--password
选项,roxctl
CLI 使用指定的密码进行身份验证。