question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`az aks command invoke` not waiting for command to complete

See original GitHub issue

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

az aks command invoke --command "sleep 6000" --resource-group <my-rg> --name <my-aks-cluster>

Describe the bug

The above command does not wait for command completion, but instead permaturely exits after approximately 5 minutes of polling for the current pod’s status.

To Reproduce

  1. Create a new AKS cluster
  2. Run the above command (sleep for 10 minutes)
  3. After approximately 5 minutes the az aks command invoke command will prematurely exit

Expected behavior

I would expect the az aks command invoke command to wait for the command that is run inside the pod to finish or rather until the pod transitioned to either of the Succeeded or Failed states.

Environment summary

➜ az --version
azure-cli                         2.36.0

core                              2.36.0
telemetry                          1.0.6

Extensions:
ssh                                1.0.0
azure-devops                      0.22.0

Dependencies:
msal                              1.17.0
azure-mgmt-resource               20.0.0

Python location '/opt/azure-cli/bin/python'
Extensions directory '/home/username/.azure/cliextensions'

Python (Linux) 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
➜ az aks command invoke --no-wait --command "kubectl version" --resource-group <my-rg> --name <my-aks-cluster>
command started at 2022-05-12 11:22:12+00:00, finished at 2022-05-12 11:22:12+00:00 with exitcode=0
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.13", GitCommit:"2444b3347a2c45eb965b182fb836e1f51dc61b70", GitTreeState:"clean", BuildDate:"2021-11-17T13:05:33Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.6", GitCommit:"07959215dd83b4ae6317b33c824f845abd578642", GitTreeState:"clean", BuildDate:"2022-03-30T18:28:25Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

Additional context

It also seems like the --no-wait flag is ignored, as polling for the status still takes place and it displays the exact same behaviour as when not providing the flag.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
navba-MSFTcommented, Aug 2, 2022

@toastedonion I hope you had a chance to look at my above comment. As a workaround you could use --no-wait option using the most recent Az CLI version. We will now proceed with closure of this GitHub issue. If you need any further assistance on this issue in future, please feel free to reopen this thread. We would be happy to help.

1reaction
navba-MSFTcommented, Jul 28, 2022

@toastedonionaz aks command invoke(the run command feature) is not designed for long running operations. There’s a hard limit in the resource provider side that the operation would expire in 30 mins. In CLI side, the timeout for polling results is 5 minutes (300 seconds). So the issue is by design.

The --no-wait option used to not work, but should have been fixed in latest cli version (2.38.0) in this PR [AKS] az aks command invoke: Add support for --no-wait by FumingZhang · Pull Request #22813 · Azure/azure-cli (github.com). Hope this answers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az aks command invoke
Files to be used by the command, use '.' to attach the current folder. --no-wait. Do not wait for the long-running operation to...
Read more >
Azure built in policy container-no-privilege-escalation ...
It is expected az aks command invoke not to work if the policy to prevent privilege escalation containers is applied.
Read more >
Execute kubectl commands from Azure CLI
How it works? It is simple. When you execute the az aks command invoke command, a new pod is deployed in your AKS...
Read more >
Azure_Cli_Commans_GUI.pdf - Complete List of AZ CLI...
Complete List of AZ CLI Commands CLI Version: 2.36.0 Dated: 1 Sep 2022 This list ... --branch-name --do-not-wait --port --repositoryaz aks command invoke...
Read more >
A Step by Step guide to building Fully Secured Private AKS ...
If you do not have already created them, please create them by clicking on ... az aks command invoke --resource-group cloud-qubes --name ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found