简体   繁体   中英

“Incorrect padding” when trying to create managed Kubernetes cluster on Azure with AKS

I am working through the instructions outlined here to try and set up a Couchbase cluster on Azure Container Service (AKS). That tutorial is using terminal/Mac, and I'm using Powershell/Windows.

I'm getting an error before I even get to the Couchbase part. I successfully created a resource group (which I called "cb_ask_spike", and yes it does appear on the Portal) from the command line, but then I try to create an AKS cluster:

az aks create --resource-group cb_aks_spike --name cbakscluster

I also tried:

az aks create --resource-group cb_aks_spike --name cbakscluster --generate-ssh-keys

In both cases, I get an error:

az aks create: error: Incorrect padding

在此处输入图片说明

I don't know what this error message means, and I can't seem to find any reference to it in the documentation or anywhere. What am I doing wrong?

I'm using azure-cli v2.0.31.

I am fairly confident that I solved why I'm getting this error, and I've updated issue 6142 on azure-cli . At this time, I believe this is a bug, and it's not fixed, but there is a workaround.

First it's important to note that --generate-ssh generates a new ssh key in ~/.ssh

I had a hunch that since ~ for me is "C:\\Users\\Matthew Groves" that the space in the path was causing the problem. Sure enough, I created a new account called "mgroves". ~ is now "C:\\Users\\mgroves" and voila, I don't get the "incorrect padding" error message anymore.

So, the workaround is either to use a new account (huge pain) or rename the folder (this is what I have done, and it's also a huge pain and I'm still finding little problems here and there all throughout my system because of it.

In addition to the now approved answer there is a solution that doesn't require you to change any directory or account name and is also easy to implement as well.

As correctly stated in the other answers the Azure CLI cannot handle the actual location where the generated SSH keys will be stored if there is a space in the path. Ie C:\\Users\\Admin Account\\.ssh\\ .

When using the az aks create command you can either use --generate-ssh-keys to let the Azure CLI handle it, OR you can specify an already existing SSH key with --ssh-key-value .

I used Git Bash to generate a new SSH key pair in the C:\\Users\\Admin Account\\.ssh\\ directory:

ssh-keygen -f ~/.ssh/aks-ssh

Now create the Azure AKS cluster while pointing to this new SSH key with:

az aks create \
  --resource-group YourResourceGroup \
  --name YourClusterName \
  --node-count 3 \
  --kubernetes-version 1.16.8 \
  --ssh-key-value ~\.ssh\aks-ssh.pub

And you are good to go!

Just verified today using az cli in Powershell for version 2.0.31. You might need to first run the az group and then create az aks command. Screenshot for your reference. Azure CLI AKS 创建

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