azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

HTTP Error 403: rate limit exceeded - az aks install cli

Open bkozub opened this issue 4 years ago • 14 comments

Describe the bug Sometimes when using bitbucket pipelines from mcr.microsoft.com/azure-cli:latest image i get the 403 Error while az aks install cli command is executed

To Reproduce

occurs randomly

Expected behavior aks cli is installed

Environment summary

Additional context

Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.19.4/bin/linux/amd64/kubectl"
Please ensure that /usr/local/bin is in your search PATH, so the `kubectl` command can be found.
CLIInternalError: The command failed with an unexpected error. Here is the traceback:
HTTP Error 403: rate limit exceeded
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
    raise ex
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 711, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
    result = cmd_copy(params)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 784, in default_command_handler
    return op(**command_args)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 329, in k8s_install_cli
    k8s_install_kubelogin(cmd, kubelogin_version, kubelogin_install_location)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 407, in k8s_install_kubelogin
    latest_release = urlopen(latest_release_url, context=context).read()
  File "/usr/local/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: rate limit exceeded```

bkozub avatar Nov 16 '20 11:11 bkozub

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm.

Issue Details
Description:

Describe the bug Sometimes when using bitbucket pipelines from mcr.microsoft.com/azure-cli:latest image i get the 403 Error while az aks install cli command is executed

To Reproduce

occurs randomly

Expected behavior aks cli is installed

Environment summary

Additional context

Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.19.4/bin/linux/amd64/kubectl"
Please ensure that /usr/local/bin is in your search PATH, so the `kubectl` command can be found.
CLIInternalError: The command failed with an unexpected error. Here is the traceback:
HTTP Error 403: rate limit exceeded
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
    raise ex
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 711, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
    result = cmd_copy(params)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 784, in default_command_handler
    return op(**command_args)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 329, in k8s_install_cli
    k8s_install_kubelogin(cmd, kubelogin_version, kubelogin_install_location)
  File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 407, in k8s_install_kubelogin
    latest_release = urlopen(latest_release_url, context=context).read()
  File "/usr/local/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: rate limit exceeded```


</td>
  </tr>
  <tr>
    <th align="left">Author:</th>
    <td>bkozub</td>
  </tr>
  <tr>
    <th align="left">Assignees:</th>
    <td>-</td>
  </tr>
  <tr>
    <th align="left">Labels:</th>
    <td>

`AKS`, `Service Attention`

</td>
  </tr>
  <tr>
    <th align="left">Milestone:</th>
    <td>-</td>
  </tr>
  </table>
  </details>

ghost avatar Nov 16 '20 11:11 ghost

aks

yonzhan avatar Nov 16 '20 11:11 yonzhan

any new about this?

waldekmanual avatar Dec 07 '20 14:12 waldekmanual

I am getting the same error https://github.com/weecology/DeepForest-pytorch/pull/41/checks?check_run_id=2179945044

henrykironde avatar Mar 24 '21 00:03 henrykironde

Is there any update on this issue? We are also encountering this issue pretty regularely. It appears in CI / CD after 50 installations "az aks install-cli". We use --base-src-url and -l over an Artifactory server with the hope to prevent this from happening but we same error occurs.

The issue seems to appear because kubelogin (even if used with -l parameter) is calling the Github API if it downloads the latest version: https://github.com/Azure/azure-cli/blob/edb293b58607450c64b634935c094405c995c212/src/azure-cli/azure/cli/command_modules/acs/custom.py#L438

so there is still 1 call to the Github API which will (if used too many times) exceed the rate limit.

kemmemha avatar Aug 18 '21 07:08 kemmemha

Hi team, any news on this? I'm working with a customer and we're facing the same issue.

phenixita avatar Sep 13 '21 08:09 phenixita

I suppose the limitation is the rate limit on Google servers, from where the cli downloads the tools. Source code

phenixita avatar Sep 13 '21 08:09 phenixita

See also #19965

stan-sz avatar Nov 22 '21 13:11 stan-sz

Suggested solution: Rather than increasing rate limits by IP, provide a second variant of the azure-cli Docker container, that already comes with the aks cli preinstalled. That way, pipelines based on Microsoft's Docker images wouldn't need to manually install it manually on each run in the first place.

@bkozub Would that resolve the issue for you as well?

Rel: https://github.com/Azure/azure-cli/issues/19965#issuecomment-1688162845

timbodeit avatar Aug 22 '23 13:08 timbodeit

Any updates on this? I agree with @timbodeit. Why don't we have a second image that has the aks cli preinstalled?

hgebrael avatar Sep 04 '23 08:09 hgebrael

Any new updates on this case? We still encounter this issue!

ekbaramundi avatar Feb 28 '24 08:02 ekbaramundi

Is there any update on this issue? We are also encountering this issue pretty regularely. It appears in CI / CD after 50 installations "az aks install-cli". We use --base-src-url and -l over an Artifactory server with the hope to prevent this from happening but we same error occurs.

The issue seems to appear because kubelogin (even if used with -l parameter) is calling the Github API if it downloads the latest version:

https://github.com/Azure/azure-cli/blob/edb293b58607450c64b634935c094405c995c212/src/azure-cli/azure/cli/command_modules/acs/custom.py#L438

so there is still 1 call to the Github API which will (if used too many times) exceed the rate limit.

I have the same problem with recent installation. In hashicorp packer, when you installed pluging, this issue happened but they implemented a variable with a github token. You can now execute the installation with a parameter with that github token and the rate is incremented drasticaly and all plugins are installed but I don't know if we can use a param with a github token in the installation of az aks install-cli.

fjbejarano-nn avatar May 13 '24 14:05 fjbejarano-nn

We noticed the same behaviour/issue in our build infrastructure where we build docker images. Is there any update on this issue?

mymichu avatar Jun 17 '24 09:06 mymichu

Any update?

safronau avatar Jun 26 '24 10:06 safronau