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 get-credentials` writes to stderr on successful acquisition starting in 2.27.1

See original GitHub issue

Describe the bug az aks get-credentials writes to stderr when merging kubernetes context into file starting in Azure CLI version 2.27.1

To Reproduce

az aks get-credentials --subscription ***** --resource-group ***** --name ***** --file 'test.kubeconfig' --admin 1> 'test.kubeconfig.stdout' 2> 'test.kubeconfig.stderr'

The test.kubeconfig.stdout file is empty but the test.kubeconfig.stderr file contains WARNING: Merged "*****" as current context in *****\test.kubeconfig. The test.kubeconfig file did not exist before executing the get-credentials command.

Expected behavior The command should not write to stderr when no issue occurs. This message used to be written to stdout (Merged "*****" as current context in *****\test.kubeconfig) instead of stderr in 2.27.0 and prior.

Environment summary Install method: MSI CLI Version: 2.27.2 OS Version: Windows 10 Shell Type: pwsh.exe on Windows

Additional context This started to cause Azure DevOps deployments to fail on August 18th because our tasks by default fail when stderr lines are detected. Tested that this issue reproduces in both Azure DevOps Azure CLI Task 2.1.1 as well as on a local machine.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jander-msftcommented, Sep 14, 2021

I would contend that:

  1. This is a breaking change. A behavioral change was made (writing out additional messages that were not written in prior same major release) that caused this issue to occur. Without any changes to our pipeline, it started to fail because of the change between 2.27.0 and 2.27.1
  2. The usage of the command as described does not request to write out diagnostic information, thus it should not write diagnostic information. Thus, the diagnostics issued by the program portion of the explanation is not acceptable. What remains is which is used for error messages; the message is not not an error. Since it does not meet either explanation, it should not be written to stderr under these conditions.
  3. The CLI should not be writing this warning message under the explained conditions. Merged "*****" as current context in *****\test.kubeconfig should only reasonably be a written when credentials were actually merged into an existing file, not when writing into a new file. This warning is being written out when the file doesn’t exist in the first place.

I’ve already mitigated this issue by using --only-show-errors. I will not set failOnStderr: false so that we can catch other actual errors when they occur.

1reaction
andyliulimingcommented, Aug 27, 2021

I think the script which call the commands should not depends on whether the stderr is empty or not. we should only check the exit code and so on. but there’s one option --only-show-errors may help in this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Azure Kubernetes Error when running "az aks get-credentials ...
When you use the command az aks get-credentials without parameter --admin , it means the CLI command uses the default value: Cluster user....
Read more >
Connecting to an AKS Cluster Non Interactivity — Part 1
Yes you are correct. This brings us on to Azure AKS Roles. az aks get-credentials --resource-group <resource group> --name <cluster name> ...
Read more >
Getting Started with the Azure Kubernetes Service (AKS)
Set your kubectl config file as the active context. az aks get-credentials -g AKSResourceGroup -n AKS-AZCLI-demo.
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