简体   繁体   中英

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. I am following the instructions in this article: 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

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.

My SSH key pair is located at C:\Users\username\.ssh and readable. 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

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-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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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