从Windows通过Powershell与Azure kubernetes群集连接时,出现错误。
正在使用的命令是-
az aks get-credentials --name clustername --resource-group rgname --subscription subsId
命令失败,出现意外错误。这是回溯:
'name'
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 578, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_jobs_serially
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 629, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\six\six.py", line 693, in reraise
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 606, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 305, in __call__
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\__init__.py", line 485, in default_command_handler
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1693, in aks_get_credentials
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 2422, in _print_or_merge_credentials
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1063, in merge_kubernetes_configurations
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1012, in _handle_merge
KeyError: 'name'
答案 0 :(得分:1)
当〜/ .kube / config的结构与az aks get-credentials
的结构不同时,例如在缺少某些键时,会发生此错误。参见https://github.com/Azure/azure-cli/issues/10812
您可以通过删除〜/ .kube / config来解决此问题。