azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Invoke-AzAksRunCommand uses an out of date version of kubectl

Open w3bward opened this issue 2 years ago • 2 comments

Description

I'm not sure where to raise this issue, but I believe the way that Invoke-AsAksRunCommand works is that it spins up a pod from a Microsoft maintained image to actually execute the command. Currently it looks like this container image has kubectl version 1.20.13, which may have compatibility issues depending on the Kubernetes version running on your AKS cluster.

In my use case, I'm trying to create a Powershell function that can be used to easily create a job from a cronjob on demand, but the API for doing so in kubectl v1.20.13 is not compatible with the API on our cluster running kubernetes v1.22.6.

Ideally, there would be different container images for different versions of kubernetes, and Invoke-AzAksRunCommand would select the appropriate image based on the cluster version.

Issue script & Debug output

PS> Invoke-AzAksRunCommand -ResourceGroupName $MyRG -Name $MyCluster -Command "kubectl version"

ProvisioningState : Succeeded
ExitCode          : 0
StartedAt         : 7/29/2022 3:14:03 PM
FinishedAt        : 7/29/2022 3:14:03 PM
Logs              : 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:"42a9a90338d705a1650fb68b7891f84b62adb0b0", GitTreeState:"clean", BuildDate:"2022-06-15T04:25:21Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

Reason            :

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.8.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script     4.1.0      Az.Aks                              {Disable-AzAksAddOn, Enable-AzAksAddOn, Get-AzAksCluster, Get-AzAksNodePool...}

Error output

No response

w3bward avatar Jul 29 '22 15:07 w3bward

@wyunchi-ms , please help to look into this item.

dingmeng-xue avatar Aug 02 '22 09:08 dingmeng-xue

Hi @w3bward , could you please share some more error message of your command? What's the compatibility issues looks like? Is it reject by service or some result is not as expected?

wyunchi-ms avatar Aug 08 '22 06:08 wyunchi-ms

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

msftbot[bot] avatar Oct 30 '22 14:10 msftbot[bot]