7.9.3.2. 使用 RDP 访问 Windows 节点

您可以使用 Remote Desktop Protocol(RDP)访问 Windows 节点。

先决条件

  • 已使用 Operator Lifecycle Manager(OLM)安装 Windows Machine Config Operator(WMCO)。
  • 您已创建了 Windows 机器集。
  • 您已将 cloud-private-key secret 中使用的密钥以及创建集群时使用的密钥添加到 ssh-agent。为安全起见,请记住在使用后从 ssh-agent 中删除密钥。
  • 已使用 ssh-bastion pod 连接到 Windows 节点。

流程

  1. 运行以下命令设定 SSH tunnel:

    $ ssh -L 2020:<windows_node_internal_ip>:3389 \ 1
        core@$(oc get service --all-namespaces -l run=ssh-bastion -o go-template="{{ with (index (index .items 0).status.loadBalancer.ingress 0) }}{{ or .hostname .ip }}{{end}}")
    1
    指定节点的内部 IP 地址,可通过运行以下命令来发现该地址:
    $ oc get nodes <node_name> -o jsonpath={.status.addresses[?\(@.type==\"InternalIP\"\)].address}
  2. 在生成的 shell 中 SSH 到 Windows 节点,并运行以下命令为用户创建密码:

    C:\> net user <username> * 1
    1
    指定云供应商用户名,如 AWS 的 Administrator 或 Azure 的 capi

现在您可以使用 RDP 客户端在 localhost:2020 远程访问 Windows 节点。