Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.

Home Page:https://aka.ms/azd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Issue] aks projects require az cli

jongio opened this issue · comments

I noticed today that aks projects now have a hard dependency on az cli. Let's do our best to remove that dependency. If there is no way to remove it, then let's update the README with the install instructions and help the user with that error message on how to install it.

After provisioning, I see this:

ERROR: deployment failed: failed invoking event handlers for 'postprovision', converting kubeconfig: exit code: 1, stdout: , stderr: 'kubelogin' is not recognized as an internal or external command,
operable program or batch file.

I see we are solving with this line in the devcontainer.
https://github.com/Azure-Samples/todo-nodejs-mongo-aks/blob/main/.devcontainer/devcontainer.json#L34

But folks who don't run in a devcontainer need to track this down themselves. The solution/workaround is to run az aks install-cli

I don't see it listed here:
https://github.com/Azure-Samples/todo-nodejs-mongo-aks/tree/main?tab=readme-ov-file#prerequisites

@jongio AKS dependency on kubectl seems to be installed in devcontainer via az aks install-cli makes us feel we are dependent on az. The pre-requisites is calling out the Kubernetes CLI (kubectl) correctly.

@wbreza can we use the devcontainer feature for the AKS kubectl deps - https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube

In addition, the actions also require kubelogin. If we can't remove it then we'll need to add it to azure-dev.yaml and azdo version as well

Error from gh action run on aks project:

2024/05/10 23:41:26 command_runner.go:307: Run exec: 'kubelogin convert-kubeconfig --login azd --kubeconfig /home/runner/.kube/aks-hw4fnnipozgxg' , err: exec: "kubelogin": executable file not found in $PATH
ERROR: deployment failed: failed invoking event handlers for 'postprovision', converting kubeconfig: exec: "kubelogin": executable file not found in $PATH,converting kubeconfig: exec: "kubelogin": executable file not found in $PATH,converting kubeconfig: exec: "kubelogin": executable file not found in $PATH

@jongio kubelogin is required when using AKS with Azure RBAC enabled clusters. We will update the pipelines to ensure all the prereqs are installed.

@jongio AKS dependency on kubectl seems to be installed in devcontainer via az aks install-cli makes us feel we are dependent on az. The pre-requisites is calling out the Kubernetes CLI (kubectl) correctly.

@wbreza can we use the devcontainer feature for the AKS kubectl deps - https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube

I believe we are already using the devcontainer feature to install kubectl. The specific callout for az aks install-cli actually installs kubelogin as well which is the easiest method to get this tool. I will see if there is any better ways to do this.