Skip to content

az aks install-cli --kubelogin-base-src-url is not using provided destination to lookup latest version #30774

@penicaudm

Description

@penicaudm

Describe the bug

For Azure China AKS operations, it is common to use binaries such as kubectl and kubelogin. However, github is not availble in China, and instead we use the Kubernetes mirror in China: https://mirror.azure.cn/kubernetes/

For instance, we use the following command in our pipelines

 az aks install-cli --base-src-url https://mirror.azure.cn/kubernetes/kubectl --kubelogin-base-src-url https://mirror.azure.cn/kubernetes/kubelogin

This command, for kubectl, uses the destination provided by the command line to lookup the latest.txt:

No version specified, will get the latest version of kubectl from "https://mirror.azure.cn/kubernetes/kubectl/stable.txt"

However, it is not done for kubelogin:

No version specified, will get the latest version of kubelogin from "https://api.github.com/repos/Azure/kubelogin/releases/latest"
Downloading client to "C:\Users\myuser\AppData\Local\Temp\tmp6b19jvjy\kubelogin.zip" from "https://mirror.azure.cn/kubernetes/kubelogin/v0.1.7/kubelogin.zip"
Connection error while attempting to download client (HTTP Error 404: Not Found)

The file does exist: https://mirror.azure.cn/kubernetes/kubelogin/latest but the az cli is looking for the github releases. This causes an issue because the mirror does not have the latest version.

Related command

az aks install-cli

Errors

No version specified, will get the latest version of kubelogin from "https://api.github.com/repos/Azure/kubelogin/releases/latest"
Downloading client to "C:\Users\myuser\AppData\Local\Temp\tmp6b19jvjy\kubelogin.zip" from "https://mirror.azure.cn/kubernetes/kubelogin/v0.1.7/kubelogin.zip"
Connection error while attempting to download client (HTTP Error 404: Not Found)

Issue script & Debug output

cli.azure.cli.command_modules.acs.custom: No version specified, will get the latest version of kubelogin from "https://api.github.com/repos/Azure/kubelogin/releases/latest"
cli.azure.cli.command_modules.acs.custom: Downloading client to "C:\Users\marce\AppData\Local\Temp\tmpmhitqm08\kubelogin.zip" from "https://mirror.azure.cn/kubernetes/kubelogin/latest/v0.1.7/kubelogin.zip"
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1991, in k8s_install_kubelogin
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 2038, in _urlretrieve
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 2033, in _urlopen_read
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 2024, in _urlopen_read
  File "urllib\request.py", line 215, in urlopen
  File "urllib\request.py", line 521, in open
  File "urllib\request.py", line 630, in http_response
  File "urllib\request.py", line 559, in error
  File "urllib\request.py", line 492, in _call_chain
  File "urllib\request.py", line 639, in http_error_default
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

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 666, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 734, 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 703, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 120, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acs/custom.py", line 1748, 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 1993, in k8s_install_kubelogin
knack.util.CLIError: Connection error while attempting to download client (HTTP Error 404: Not Found)

cli.azure.cli.core.azclierror: Connection error while attempting to download client (HTTP Error 404: Not Found)
az_command_data_logger: Connection error while attempting to download client (HTTP Error 404: Not Found)
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000002391AA3A020>]

Expected behavior

The kubelogin installer should lookup https://mirror.azure.cn/kubernetes/kubelogin/latest which is the --kubelogin-base-src-url value with /latest appended to it.

Environment Summary

azure-cli                         2.68.0

core                              2.68.0
telemetry                          1.1.0

Extensions:
aks-preview                     13.0.0b2

Dependencies:
msal                              1.31.1
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\marce\.azure\cliextensions'

Python (Windows) 3.12.8 (tags/v3.12.8:2dc476b, Dec  3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

I have created the issue here: Azure/container-service-for-azure-china#75 for the lack of up to date files in the china mirror.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AKSaz aks/acs/openshiftAuto-AssignAuto assign by botPossible-SolutionService AttentionThis issue is responsible by Azure service team.Similar-IssuebugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions