This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.3.6. 生成 SSH 私钥并将其添加到代理中
如果要在集群上执行安装调试或灾难恢复,则必须为 ssh-agent
和安装程序提供 SSH 密钥。您可以使用此密钥访问公共集群中的 bootstrap 机器来排除安装问题。
在生产环境中,您需要进行灾难恢复和调试。
您可以使用此密钥以 core
用户身份通过 SSH 连接到 master 节点。在部署集群时,此密钥会添加到 core
用户的 ~/.ssh/authorized_keys
列表中。
您必须使用一个本地密钥,而不要使用在特定平台上配置的密钥,如 AWS 密钥对。
流程
如果还没有为计算机上免密码身份验证而配置的 SSH 密钥,请创建一个。例如,在使用 Linux 操作系统的计算机上运行以下命令:
ssh-keygen -t ed25519 -N '' \ -f <path>/<file_name>
$ ssh-keygen -t ed25519 -N '' \ -f <path>/<file_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 指定新 SSH 密钥的路径和文件名,如
~/.ssh/id_rsa
。如果您已有密钥对,请确保您的公钥位于~/.ssh
目录中。
运行此命令会在指定的位置生成不需要密码的 SSH 密钥。
注意如果您计划在
x86_64
架构中安装使用 FIPS 验证的/Modules in Process 加密库的 OpenShift Container Platform 集群,不要创建使用ed25519
算法的密钥。反之,创建一个使用rsa
或ecdsa
算法的密钥。作为后台任务启动
ssh-agent
进程:eval "$(ssh-agent -s)"
$ eval "$(ssh-agent -s)"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
Agent pid 31874
Agent pid 31874
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意如果您的集群采用 FIPS 模式,则只使用 FIPS 兼容算法来生成 SSH 密钥。密钥必须是 RSA 或 ECDSA。
将 SSH 私钥添加到
ssh-agent
:ssh-add <path>/<file_name>
$ ssh-add <path>/<file_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 指定 SSH 私钥的路径和文件名,如
~/.ssh/id_rsa
后续步骤
- 在安装 OpenShift Container Platform 时,为安装程序提供 SSH 公钥。如果在您置备的基础架构上安装集群,您必须将此密钥提供给集群的机器。