Invoke-AzAksRunCommand with subdirectories in -CommandContextAttachment doesn't work due to the use of backslashes as path separators #20734
Labels
AKS
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
customer-reported
Tracking
We will track status and follow internally
Description
A directory, which contains kubernetes manifests on the top level, can be applied to an AKS cluster using
Invoke-AzAksRunCommand -CommandContextAttachment <path> -Command "kubectl apply -f ."
However, if the directory contains sub-directories, then Invoke-AzAksRunCommand fails with the misleading error message:
Failed to run command due to cluster perf issue, container command- in aks-command namespace did not start within 30s on your cluster, retry may helps. If issue persist, you may need to tune your cluster with better performance (larger node/paid tier).
Invoke-AzAksRunCommand creates a pod with an init-container, which does the following:
&& echo copying default SA && cp -r /var/run/secrets/kubernetes.io/serviceaccount
/command-state/k8s-identity && echo wait for AAD token && inotifywait -e modify
-t 60 /command-state/k8s-identity/token && sleep 5s
By looking into the logs of the init-container created by
Invoke-AzAksRunCommand
, we noticed that it fails with exit code 1 after executing theunzip
step. According to the man page ofunzip
, it returns 1 when there are errors OR warnings. By inspecting the logs, we see indeed such a warning, which reads: warning: /cmd-context/context.zip appears to use backslashes as path separators. We believe that this root cause of the issue.Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: