简体   繁体   English

使用 SSH 连接到 AKS 群集节点

[英]Connect with SSH to AKS cluster nodes

I am trying to connect with SSH to a scale set-based AKS cluster node for maintenance purposes.我正在尝试将 SSH 连接到基于规模集的 AKS 群集节点以进行维护。 I am following the instructions in this article: https://docs.microsoft.com/en-us/azure/aks/ssh我正在按照本文中的说明进行操作: https://docs.microsoft.com/en-us/azure/aks/ssh

However, when I run: az vmss extension set --name VMAccessForLinux --protected-settings '{\"username\":\"azureuser\", \"ssh_key\":\"$(cat ~/.ssh/id_rsa.pub)\"}' --publisher Microsoft.OSTCExtensions --resource-group $RG_NAME --version 1.4 --vmss-name $NODE_NAME但是,当我运行时: az vmss extension set --name VMAccessForLinux --protected-settings '{\"username\":\"azureuser\", \"ssh_key\":\"$(cat ~/.ssh/id_rsa.pub)\"}' --publisher Microsoft.OSTCExtensions --resource-group $RG_NAME --version 1.4 --vmss-name $NODE_NAME

I get the following error: VM has reported a failure when processing extension 'VMAccessForLinux'. Error message: "Enable failed: Failed to generate public key file.我收到以下错误: VM has reported a failure when processing extension 'VMAccessForLinux'. Error message: "Enable failed: Failed to generate public key file. VM has reported a failure when processing extension 'VMAccessForLinux'. Error message: "Enable failed: Failed to generate public key file.

My SSH key pair is located at C:\Users\username\.ssh and readable.我的 SSH 密钥对位于C:\Users\username\.ssh并且可读。 I have tried generating multiple pairs, but the issue does not seem to be here.我尝试生成多对,但问题似乎不在这里。 For generating the keys I used: ssh-keygen -m PEM -t rsa -b 4096为了生成我使用的密钥: ssh-keygen -m PEM -t rsa -b 4096

Any idea where I can find more information about this error or how can I troubleshoot it in more detail?知道在哪里可以找到有关此错误的更多信息,或者如何更详细地对其进行故障排除? Thank you.谢谢你。

The reason is that you need to use the double quotes to set the value of the parameter `--protected-setting like this:原因是你需要使用双引号来设置参数`--protected-setting的值,如下所示:

--protected-settings "{\"username\":\"azureuser\", \"ssh_key\":\"$(cat ~/.ssh/id_rsa.pub)\"}"

Only when you use the double quotes then the character \ can work.只有当您使用双引号时,字符\才能起作用。 You need to read the document carefully.您需要仔细阅读文档。 And make sure the SSH public key is in the right format.并确保 SSH 公钥格式正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM