Azure / azure-cli

Azure Command-Line Interface
MIT License
4k stars 2.98k forks source link

`az aks install-cli` does not work on Darwin/arm64 #26353

Closed d-mankowski-synerise closed 1 year ago

d-mankowski-synerise commented 1 year ago

Although this problem is similar to https://github.com/Azure/azure-cli/issues/26292, I believe it requires a new issue report

Related command az aks install-cli

Describe the bug I am unable to install aks install-cli needed by kubelogin on MacBook Pro 2021 M1.

❯ 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 0x102f89e10>, <function OutputProducer.on_global_arguments at 0x103012b90>, <function CLIQuery.on_global_arguments at 0x10308c040>]
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.054         6        48
cli.azure.cli.core: Total (1)                 0.054         6        48
cli.azure.cli.core: Loaded 6 groups, 48 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 0x103a9dd80>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/dmankows/.azure/commands/2023-05-05.20-16-10.aks_install-cli.72616.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 0x103aaa710>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x103af8430>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x103af8550>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x103012c20>, <function CLIQuery.handle_query_parameter at 0x10308c0d0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x103af84c0>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/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.48.1/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.48.1/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.48.1/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.48.1/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.48.1/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.48.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1468, in k8s_install_cli
    arch = get_arch_for_cli_binary()
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/acs/custom.py", line 1483, in get_arch_for_cli_binary
    raise CLIInternalError(
azure.cli.core.azclierror.CLIInternalError: Unsupported architecture: 'arm64'. Currently only supports downloading the binary of arm64/amd64 architecture for linux/darwin/windows platform, please download the corresponding binary for other platforms or architectures by yourself

cli.azure.cli.core.azclierror: Unsupported architecture: 'arm64'. Currently only supports downloading the binary of arm64/amd64 architecture for linux/darwin/windows platform, please download the corresponding binary for other platforms or architectures by yourself
az_command_data_logger: Unsupported architecture: 'arm64'. Currently only supports downloading the binary of arm64/amd64 architecture for linux/darwin/windows platform, please download the corresponding binary for other platforms or architectures by yourself
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x103a9dfc0>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.279 seconds (init: 0.104, invoke: 0.175)
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 3742 in cache
telemetry.check: Negative: The /Users/dmankows/.azure/telemetry.txt was modified at 2023-05-05 20:16:08.685317, which in less than 600.000000 s

To Reproduce Execute az aks install-cli

Expected behavior Installation works fine on Darwin/arm64

Environment summary

❯ uname -a
Darwin SYNE0095.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64 arm Darwin

~
❯ arch
arm64

~
❯ uname -m
arm64
az --version
azure-cli                         2.48.1

core                              2.48.1
telemetry                          1.0.8

Dependencies:
msal                              1.20.0
azure-mgmt-resource               22.0.0

Python location '/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/bin/python'
Extensions directory '/Users/dmankows/.azure/cliextensions'

Python (Darwin) 3.10.11 (main, Apr  7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Installation via Homebrew works fine

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

navba-MSFT commented 1 year ago

@d-mankowski-synerise Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT commented 1 year ago

@d-mankowski-synerise Please follow the below steps and check if that helps:

  1. Run the below command:

curl -LO "https://dl.k8s.io/release/v1.27.1/bin/darwin/arm64/kubectl"

  1. Make the kubectl binary executable.

chmod +x ./kubectl

  1. Move the kubectl binary to a file location on your system PATH.

    sudo mv ./kubectl /usr/local/bin/kubectl
    sudo chown root: /usr/local/bin/kubectl

    Note: Make sure /usr/local/bin is in your PATH environment variable.

  2. Test to ensure the version you installed is up-to-date:

kubectl version --client --output=yaml

d-mankowski-synerise commented 1 year ago

The kubectl version that I am using is the latest one installed via homebrew; following the steps you posted did not help:

❯ which kubectl
/usr/local/bin/kubectl

~
❯ kubectl version --client --output=yaml
Alias tip: k version --client --output=yaml
clientVersion:
  buildDate: "2023-04-14T13:21:19Z"
  compiler: gc
  gitCommit: 4c9411232e10168d7b050c49a1b59f6df9d7ea4b
  gitTreeState: clean
  gitVersion: v1.27.1
  goVersion: go1.20.3
  major: "1"
  minor: "27"
  platform: darwin/arm64
kustomizeVersion: v5.0.1

~
❯ az aks install-cli
Unsupported architecture: 'arm64'. Currently only supports downloading the binary of arm64/amd64 architecture for linux/darwin/windows platform, please download the corresponding binary for other platforms or architectures by yourself
navba-MSFT commented 1 year ago

@FumingZhang Is this a known issue for MacBook Pro 2021 M1 ( Darwin/arm64 ) ?

FumingZhang commented 1 year ago

Didn't expect platform.machine() would return "arm64", will fix this in next cli release.

sumit-anantwar commented 1 year ago

@FumingZhang what's the workaround until the fix is released?

d-mankowski-synerise commented 1 year ago

@sumit-anantwar I installed kubelogin by using https://azure.github.io/kubelogin/install.html#homebrew

FumingZhang commented 1 year ago

Hey @sumit-anantwar, please follow these steps to install kubectl as a workaround

@d-mankowski-synerise Please follow the below steps and check if that helps:

  1. Run the below command:

curl -LO "https://dl.k8s.io/release/v1.27.1/bin/darwin/arm64/kubectl"

  1. Make the kubectl binary executable.

chmod +x ./kubectl

  1. Move the kubectl binary to a file location on your system PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl

Note: Make sure /usr/local/bin is in your PATH environment variable.

  1. Test to ensure the version you installed is up-to-date:

kubectl version --client --output=yaml

For kubelogin, may choose appropriate binary from release page

julyfirst commented 1 year ago

If you enter the az aks install-cli command, the same error appears. Did you fixed it?

FumingZhang commented 1 year ago

Hey @julyfirst, which version of azure-cli are you using? Could check via az version. The above change is added to 2.49.0

julyfirst commented 1 year ago

@FumingZhang I'm using the 2.48.1 version. As you said, I changed to 2.49.0, so it was resolved. Thank you.