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 fails when env:KUBECONFIG is set with windows paths

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

az aks get-credentials fails when env:KUBECONFIG is set with windows paths

Command Name az aks get-credentials

Errors:

Merged "ss-locn-dev-tst-aks001" as current context in C

To Reproduce:

When the environment variable KUBECONFIG is set to

  • %USERPROFILE%.kube\config;%USERPROFILE%.kube\k8stest.config or
  • %USERPROFILE%.kube\config az aks get-credentials fails but produces truncated output as follows - Merged "ss-locn-dev-tst-aks001" as current context in C

If I change environment variable KUBECONFIG to

  • ~/.kube/config

Then the command finishes successfully and the config file is produced successfully output is as follows: Merged "ss-locn-dev-tst-aks001" as current context in ~/.kube/config

However kubectl config get-contexts only lists the Azure hosted cluster and not my local or vmware hosted cluster.

if I then change environment variable KUBECONFIG back to

  • %USERPROFILE%.kube\config;%USERPROFILE%.kube\k8stest.config Then kubectl config get-contexts lists all of the contexts correctly

  • Put any pre-requisite steps here…

  • az aks get-credentials --resource-group {} --name {}

Expected Behavior

Ideally I would like to be able to use az aks get-credentials to produce a standalone config file without merging, and then be able to append the new config file path to the KUBECONFIG environment variable.

Environment Summary

Windows-10-10.0.19044-SP0
Python 3.10.4
Installer: MSI

azure-cli 2.36.0
kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"8211ae4d6757c3fedc53cd740d163ef65287276a", GitTreeState:"clean", BuildDate:"2022-03-31T20:28:03Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
crownecommented, May 20, 2022

Hi, thanks for your help. The --file option which you mentioned has helped me work around the issue, So I’m happy with the way things are for now.

1reaction
navba-MSFTcommented, May 11, 2022

@crowne Thanks for reaching out to us and sharing this feedback. We are looking into this issue. I will update this thread once I have more details on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure kubernetes: az aks get-credentials doesn't work - MSDN
Hello,. I have the following problem - I am trying to create kubernetes cluster on Azure using az aks.
Read more >
Config file isn't available when connecting - Azure
Troubleshoot issues caused by a missing config file when you attempt to connect to an Azure Kubernetes Service (AKS) cluster.
Read more >
Limit access to kubeconfig in Azure Kubernetes Service (AKS)
The az aks get-credentials command lets you get the access credentials for an AKS cluster and merges them into the kubeconfig file.
Read more >
Reset the credentials for a cluster - Azure Kubernetes Service
The service principal ID is set as a variable named SP_ID for use with the az ad sp credential list command. Azure CLI...
Read more >
Troubleshoot Azure Kubernetes Service cluster creation issues
This article outlines the basic troubleshooting methods to use if you can't create or deploy a Microsoft Azure Kubernetes Service (AKS) ...
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