weixin_39926613
weixin_39926613
2020-12-02 09:50

Error: unknown flag: --address when running az aks browse

when running the command az aks browse i'm getting the following error:


Merged {cluster name} as current context in /tmp/tmpfcf8p45e
Proxy running on http://127.0.0.1:8001/
Press CTRL+C to close the tunnel...
Error: unknown flag: --address

Examples:
  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
  kubectl port-forward pod/mypod 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
  kubectl port-forward deployment/mydeployment 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service
  kubectl port-forward service/myservice 5000 6000

  # Listen on port 8888 locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod 8888:5000

  # Listen on a random port locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod :5000

Options:
      --pod-running-timeout=1m0s: The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running

Usage:
  kubectl port-forward TYPE/NAME [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

unknown flag: --address

This afternoon it worked, however, azure cli was updated to version 2.0.59 when I booted up my laptop. Not sure what the previous version was.

out put of az --version:


az --version
azure-cli                         2.0.59

acr                                2.2.1
acs                               2.3.18
advisor                            2.0.0
ams                                0.4.2
appservice                        0.2.14
backup                             1.2.1
batch                              4.0.0
batchai                            0.4.7
billing                            0.2.0
botservice                         0.1.7
cdn                                0.2.0
cloud                              2.1.0
cognitiveservices                  0.2.4
command-modules-nspkg               2.0.2
configure                         2.0.20
consumption                        0.4.2
container                         0.3.14
core                              2.0.59
cosmosdb                           0.2.8
dla                                0.2.4
dls                                0.1.8
dms                                0.1.2
eventgrid                          0.2.1
eventhubs                          0.3.3
extension                          0.2.3
feedback                           2.1.4
find                              0.2.13
hdinsight                          0.3.1
interactive                        0.4.1
iot                                0.3.6
iotcentral                         0.1.6
keyvault                          2.2.12
kusto                              0.2.0
lab                                0.1.5
maps                               0.3.3
monitor                           0.2.10
network                            2.3.3
nspkg                              3.0.3
policyinsights                     0.1.1
profile                            2.1.3
rdbms                              0.3.7
redis                              0.4.1
relay                              0.1.3
reservations                       0.4.1
resource                          2.1.11
role                               2.4.1
search                             0.1.1
security                           0.1.0
servicebus                         0.3.3
servicefabric                     0.1.13
signalr                            1.0.0
sql                                2.1.9
sqlvm                              0.1.0
storage                            2.3.1
telemetry                          1.0.1
vm                                2.2.16

Python location '/opt/az/bin/python3'
Extensions directory '/home/rienk/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Feb 21 2019, 23:57:48) 
[GCC 8.2.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

该提问来源于开源项目:Azure/azure-cli

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

11条回答

  • weixin_39607873 weixin_39607873 4月前

    I hit this today too. Looks like kubectl didn't have the --address flag until >v1.13. I think re-running az aks install-cli should fix things? If not, check and see if you have more than one kubectl in your path (cmd prompt, run "where kubectl"). I had a second copy inside the docker install that was overriding the azure installed version.

    点赞 评论 复制链接分享
  • weixin_39881155 weixin_39881155 4月前

    I just hit the same thing today trying to run az aks browse in Azure Cloud Shell.

    点赞 评论 复制链接分享
  • weixin_39926613 weixin_39926613 4月前

    thanks superlime! updating kubectl to > 1.13 worked for me. I would've expected the azure-cli to force a kubectl update if there is a dependency on a specific version.

    点赞 评论 复制链接分享
  • weixin_39881155 weixin_39881155 4月前

    That worked for me locally but Cloud Shell doesn't appear to allow kubectl upgrades.

    点赞 评论 复制链接分享
  • weixin_39857899 weixin_39857899 4月前

    Following. Facing similar issue with az aks browse. on cloud shell

    点赞 评论 复制链接分享
  • weixin_39778668 weixin_39778668 4月前

    Same problem over here :(

    点赞 评论 复制链接分享
  • weixin_39627481 weixin_39627481 4月前

    Upgrading CLI seems to download new version 1.13.4: $ az aks install-cli Downloading client to "C:\Users\paaland.azure-kubectl\kubectl.exe" from "https://storage.googleapis.com/kubernetes-release/release/v1.13.4/bin/windows/amd64/kubectl.exe"

    But running kubecl version afterwards shows v1.10.11.

    Not sure where az aks install-cli puts the file. But it's apparently not the first place in my path.

    Running "which kubectl.exe" (cygwin) shows it will run /Program Files/Docker/Docker/Resources/bin/kubectl.exe which is the v1.10.11 version.

    Searching for kubectl.exe also shows a copy in:

    c:\Users\.azure-kubectl\kubectl.exe which is the v1.13.4 one. So changeing path order to ensure it hits the last one should work.

    tldr: If you have Docker for Windows installed with kubernetes support it stores an older version of kubectl.exe in c:\Program Files\Docker\Docker\Resources\bin\kubectl.exe which is earlier in the PATH setting than c:\Users\.azure-kubectl\kubectl.exe which is the one AZ CLI places.

    Either upgrade/remove the docker one, or change your path order.

    点赞 评论 复制链接分享
  • weixin_39859128 weixin_39859128 4月前

    I had a similar issue due to conflicting versions of kubectl on my mac. which kubectl was resolving to a version installed via google-cloud-sdk, which installed a script in my .bash_profile that prepended /Users/me/google-cloud-sdk/bin to my PATH. I removed the script (you might want to manually append google-cloud-sdk to your path), opened a new shell, and the az aks browse worked!

    点赞 评论 复制链接分享
  • weixin_39761880 weixin_39761880 4月前

    i have same issue. does anyone know what is the solution. My CLI version is 2.0.59 which seems fine as well

    点赞 评论 复制链接分享
  • weixin_39769091 weixin_39769091 4月前

    Excellent. its works for me.

    点赞 评论 复制链接分享
  • weixin_39630498 weixin_39630498 4月前

    Should be fixed with recent versions of kubectl.

    点赞 评论 复制链接分享