azure-cli
azure-cli copied to clipboard
az aks install-cli failing
Describe the bug
azure cli installed successfully but unable to install aks cli: error message: Olivi@MacBook-Air ~ % sudo az aks install-cli Password: The detected architecture of current device is "arm64", and the binary for "arm64" will be downloaded. If the detectiton is wrong, please download and install the binary corresponding to the appropriate architecture. No version specified, will get the latest version of kubectl from "https://storage.googleapis.com/kubernetes-release/release/stable.txt" Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.28.3/bin/darwin/arm64/kubectl" The command failed with an unexpected error. Here is the traceback: IncompleteRead(52033877 bytes read, 3329837 more expected) Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1595, in k8s_install_cli k8s_install_kubectl(cmd, client_version, install_location, base_src_url, arch=arch) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1773, in k8s_install_kubectl _urlretrieve(file_url, install_location) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1871, in _urlretrieve f.write(req.read()) File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 482, in read s = self._safe_read(self.length) File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 633, in _safe_read raise IncompleteRead(data, amt-len(data)) http.client.IncompleteRead: IncompleteRead(52033877 bytes read, 3329837 more expected) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Related command
az aks install-cli
Errors
Olivi@MacBook-Air ~ % sudo az aks install-cli Password: The detected architecture of current device is "arm64", and the binary for "arm64" will be downloaded. If the detectiton is wrong, please download and install the binary corresponding to the appropriate architecture. No version specified, will get the latest version of kubectl from "https://storage.googleapis.com/kubernetes-release/release/stable.txt" Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.28.3/bin/darwin/arm64/kubectl" The command failed with an unexpected error. Here is the traceback: IncompleteRead(52033877 bytes read, 3329837 more expected) Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1595, in k8s_install_cli k8s_install_kubectl(cmd, client_version, install_location, base_src_url, arch=arch) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1773, in k8s_install_kubectl _urlretrieve(file_url, install_location) File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1871, in _urlretrieve f.write(req.read()) File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 482, in read s = self._safe_read(self.length) File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 633, in _safe_read raise IncompleteRead(data, amt-len(data)) http.client.IncompleteRead: IncompleteRead(52033877 bytes read, 3329837 more expected) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Issue script & Debug output
Olivi@MacBook-Air ~ % az aks --debug
cli.knack.cli: Command arguments: ['aks', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x1013de4d0>, <function OutputProducer.on_global_arguments at 0x101473490>, <function CLIQuery.on_global_arguments at 0x1014dc940>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'aks': ['azure.cli.command_modules.acs']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: acs 0.034 7 54
cli.azure.cli.core: Total (1) 0.034 7 54
cli.azure.cli.core: Loaded 7 groups, 54 commands.
cli.azure.cli.core: Found a match in the command group table for 'aks'.
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x101f8ad40>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/Olivi/.azure/commands/2023-10-24.11-40-22.aks.34664.log'.
az_command_data_logger: command args: aks --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
cli.azure.cli.core.azclierror: the following arguments are required: _subcommand az_command_data_logger: the following arguments are required: _subcommand
Examples from AI knowledge base: az aks list List managed Kubernetes clusters. (autogenerated)
az aks get-credentials --admin --name MyManagedCluster --resource-group MyResourceGroup Get access credentials for a managed Kubernetes cluster. (autogenerated)
az aks install-cli Download and install kubectl, the Kubernetes command-line tool. Download and install kubelogin, a client-go credential (exec) plugin implementing azure authentication. (autogenerated)
https://docs.microsoft.com/en-US/cli/azure/aks#az_aks_list Read more about the command in reference docs cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x101f8af80>] az_command_data_logger: exit code: 2 cli.main: Command ran in 0.672 seconds (init: 0.093, invoke: 0.579) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3717 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/telemetry/init.py /Users/Olivi/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process. Olivi@MacBook-Air ~ %
Expected behavior
To be able to locally manages my aks cluster
Environment Summary
Olivi@MacBook-Air ~ % az --version azure-cli 2.53.0
core 2.53.0 telemetry 1.1.0
Dependencies: msal 1.24.0b2 azure-mgmt-resource 23.1.0b2
Python location '/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/bin/python' Extensions directory '/Users/Olivi/.azure/cliextensions'
Python (Darwin) 3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date. Olivi@MacBook-Air ~ %
Additional context
No response
Hi @oliviao12345 Find similar issue https://github.com/Azure/azure-cli/issues/17125.
Issue title | az aks install-cli Failed |
Create time | 2021-02-26 |
Comment number | 3 |
Possible solution: The error message in the new issue is very similar to the error message in the old issue, and both issues seem to be caused by network problems. The solution to the old issue was to rerun the command and route to the appropriate team. Therefore, I suggest that you try rerunning the command and see if the issue persists. If it does, you may want to contact the appropriate team for further assistance.
Please confirm if this resolves your issue.
Thank you for opening this issue, we will look into it.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dyu1208, @FumingZhang, @andyliuliming.
@oliviao12345, this error occurs because you have poor internet connections. As the error message said, you have downloaded about 52MB of data, and there are still about 3MB of data that have not been downloaded.
Workarounds would be
- Rerun the command to see if it succeeds.
- Download the binary by yourself. In your case, this should be 1.28.3 for darwin-arm64 (https://storage.googleapis.com/kubernetes-release/release/v1.28.3/bin/darwin/arm64/kubectl).
I'll add a retry to this piece code as a fix.
Getting a 503 error on windows using the command az aks install-cli
. Problem has persisted for the past 18 hours.
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
> az aks install-cli
The command failed with an unexpected error. Here is the traceback:
HTTP Error 503: Service Unavailable
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1590, in k8s_install_cli
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1734, in k8s_install_kubectl
File "urllib\request.py", line 216, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 634, in http_response
File "urllib\request.py", line 563, in error
File "urllib\request.py", line 496, in _call_chain
File "urllib\request.py", line 643, in http_error_default
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
@bandwiches, the 503 error you met is also caused bad network condition. As you said, this problem has been present for the past 18 hours, so adding retry will most likely not fix the issue. BTW, the download address is from Google Storage (if you didn't set profile to azure china cloud).
@FumingZhang I see the link in your previous post and I agree that the download address is Google Storage, but I disagree that 503 is a "bad network connection". 503 is a server side "service unavailable" response and it fails immediately when using az aks install-cli
command, but the direct links works like a charm. Tells me that there is somethig
Workaround
- Install
kubectl
- az login
- az account set --subscription ...
- az aks get-credentials ...
AZ Version
> az version
{
"azure-cli": "2.52.0",
"azure-cli-core": "2.52.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}
Full AKS Debug
> az aks install-cli --debug
cli.knack.cli: Command arguments: ['aks', 'install-cli', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x00000176FF875240>, <function OutputProducer.on_global_arguments at 0x00000176FF9C3EB0>, <function CLIQuery.on_global_arguments at 0x00000176FFC0D240>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'aks': ['azure.cli.command_modules.acs']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: acs 0.036 7 54
cli.azure.cli.core: Total (1) 0.036 7 54
cli.azure.cli.core: Loaded 7 groups, 54 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : aks install-cli
cli.azure.cli.core: Command table: aks install-cli
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000017682294430>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '..redacted..\2023-10-27.14-32-27.aks_install-cli.17424.log'.
az_command_data_logger: command args: aks install-cli --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x00000176822970A0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x00000176822ED090>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x00000176822ED1B0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000176FF9C3F40>, <function CLIQuery.handle_query_parameter at 0x00000176FFC0D2D0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x00000176822ED120>]
cli.azure.cli.command_modules.acs.custom: The detected architecture of current device is "amd64", and the binary for "amd64" will be downloaded. If the detectiton is wrong, please download and install the binary corresponding to the appropriate architecture.
cli.azure.cli.command_modules.acs.custom: No version specified, will get the latest version of kubectl from "https://storage.googleapis.com/kubernetes-release/release/stable.txt"
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1590, in k8s_install_cli
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1734, in k8s_install_kubectl
File "urllib\request.py", line 216, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 634, in http_response
File "urllib\request.py", line 563, in error
File "urllib\request.py", line 496, in _call_chain
File "urllib\request.py", line 643, in http_error_default
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: HTTP Error 503: Service Unavailable
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1590, in k8s_install_cli
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1734, in k8s_install_kubectl
File "urllib\request.py", line 216, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 634, in http_response
File "urllib\request.py", line 563, in error
File "urllib\request.py", line 496, in _call_chain
File "urllib\request.py", line 643, in http_error_default
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
az_command_data_logger: HTTP Error 503: Service Unavailable
Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1590, in k8s_install_cli
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1734, in k8s_install_kubectl
File "urllib\request.py", line 216, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 634, in http_response
File "urllib\request.py", line 563, in error
File "urllib\request.py", line 496, in _call_chain
File "urllib\request.py", line 643, in http_error_default
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000017682294670>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.739 seconds (init: 0.248, invoke: 0.491)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 6939 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\redacted\.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.
I also meet the similar question when I try to use the underline command on macbook2.The url is invalid,how can I change this command to install kubectl?
(base) az aks install-cli
The detected architecture of current device is "arm64", and the binary for "arm64" will be downloaded. If the detection is wrong, please download and install the binary corresponding to the appropriate architecture. No version specified, will get the latest version of kubectl from "https://mirror.azure.cn/kubernetes/kubectl/stable.txt" Downloading client to "/usr/local/bin/kubectl" from "https://mirror.azure.cn/kubernetes/kubectl/v1.29.2/bin/darwin/arm64/kubectl" Connection error while attempting to download client (HTTP Error 404: Not Found)
Hey @hai-xin, it seems that the mirror in china cloud is no longer maintained. The workaround is to install kubectl and kubelogin (if necessary) by yourself
- https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/
- https://azure.github.io/kubelogin/install.html#homebrew