Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az acs kubernetes get-credentials fails in azure-cli-acs 2.0.17 #4679

Closed
AlexeyAtIgloo opened this issue Oct 16, 2017 · 15 comments
Closed

az acs kubernetes get-credentials fails in azure-cli-acs 2.0.17 #4679

AlexeyAtIgloo opened this issue Oct 16, 2017 · 15 comments
Labels
ACS az acs/aks/openshift bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@AlexeyAtIgloo
Copy link

Description

Outline the issue here:
Unable to obtain kubectl config in latest version of CLI

Works in older version: pip install azure-cli-acs==2.0.16

Trace:

Traceback (most recent call last):
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/core/application.py", line 212, in execute
    result = expanded_arg.func(params)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 620, in _execute_command
    reraise(*sys.exc_info())
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 602, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 814, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 836, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/Users/apopovich/pythonenvs/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/acs_client.py", line 65, in secure_copy
    proxy = paramiko.ProxyCommand(host_config['proxycommand'])
KeyError: 'proxycommand'

interestingly in ssh library this key gets removed:
https://github.com/paramiko/paramiko/blob/6978c7a0b8faa683b119de3a0c096be31ac4fdc9/paramiko/config.py#L137


Environment summary

Python 3.6.3 virtual environment

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here:
pip install azure-cli==2.0.18

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here:

azure-cli (2.0.18)

acr (2.0.13)
acs (2.0.17)
appservice (0.1.18)
backup (1.0.1)
batch (3.1.5)
billing (0.1.5)
cdn (0.0.9)
cloud (2.0.8)
cognitiveservices (0.1.8)
command-modules-nspkg (2.0.1)
component (2.0.7)
configure (2.0.11)
consumption (0.1.5)
container (0.1.11)
core (2.0.18)
cosmosdb (0.1.13)
dla (0.0.12)
dls (0.0.15)
eventgrid (0.1.4)
extension (0.0.4)
feedback (2.0.6)
find (0.2.7)
interactive (0.3.10)
iot (0.1.12)
keyvault (2.0.12)
lab (0.0.11)
monitor (0.0.10)
network (2.0.16)
nspkg (3.0.1)
profile (2.0.14)
rdbms (0.0.7)
redis (0.2.9)
resource (2.0.16)
role (2.0.13)
servicefabric (0.0.4)
sf (1.0.8)
sql (2.0.13)
storage (2.0.17)
vm (2.0.16)

Python location '/Users/user/pythonenvs/az/bin/python'
Extensions directory '/Users/user/.azure/cliextensions'

Python (Darwin) 3.6.3 (default, Oct  4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

Legal docs and information: aka.ms/AzureCliLegal

OS Version: What OS and version are you using?
Answer here:
MacOS Sierra 10.12.6

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here:
zsh

@derekbekoe derekbekoe added the ACS az acs/aks/openshift label Oct 16, 2017
@tjprescott tjprescott added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 16, 2017
@aheumaier
Copy link

aheumaier commented Oct 17, 2017

Confirmed for Azure CLI 2.0.19 and ACS version 2.0.17

@rushsteve1
Copy link

rushsteve1 commented Oct 17, 2017

Also confirmed. Azure CLI 2.0.19 and ACS version 2.0.17

@doggy8088
Copy link

I find out a workaround for this issue. Just install the latest az-dev version solved my problem. Here is the steps to workaround this:

  1. Install Python
    choco install python -y
  2. Install pip
    wget https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
  3. Install the latest Azure CLI 2.0 using pip
    pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge

@buzzfrog
Copy link

buzzfrog commented Oct 18, 2017

A workaround is also to do it manually:
mkdir $HOME/.kube
scp azureuser@{master-dns-name}:.kube/config $HOME/.kube/config

@AlexeyAtIgloo
Copy link
Author

Downgrading just ACS package after installing full cli also works: pip install azure-cli-acs==2.0.16

@bacongobbler
Copy link

bacongobbler commented Oct 18, 2017

It looks like this was fixed relatively recently: 5b4a0db

See #4646 for ways to install the bleeding edge of azure-cli.

@lvnilesh
Copy link

az acs kubernetes get-credentials --resource-group=k8s --name=cluster
'proxycommand'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/core/application.py", line 212, in execute
    result = expanded_arg.func(params)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 620, in _execute_command
    reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 602, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 814, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 835, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/usr/local/Cellar/azure-cli/2.0.19/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/acs_client.py", line 65, in secure_copy
    proxy = paramiko.ProxyCommand(host_config['proxycommand'])
KeyError: 'proxycommand'

@mcwienczek
Copy link

same happening with CLI 2.0.19

@rjtsdl
Copy link
Contributor

rjtsdl commented Oct 24, 2017

@troydai it should be fixed now. We can close this.

@derekbekoe
Copy link
Member

2.0.20 has been released.

@AlexeyAtIgloo
Copy link
Author

Thanks guys! Just tested un 2.0.20, works great!

@jamoham
Copy link

jamoham commented Nov 9, 2017

I am still hitting this issue on 2.0.20

Error reading SSH protocol banner
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/transport.py", line 2000, in _check_banner
    buf = self.packetizer.readline(timeout)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/packet.py", line 353, in readline
    buf += self._read_timeout(timeout)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/packet.py", line 546, in _read_timeout
    raise socket.timeout()
socket.timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/core/application.py", line 212, in execute
    result = expanded_arg.func(params)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 620, in _execute_command
    reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 602, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 773, in k8s_get_credentials
    _k8s_get_credentials_internal(name, acs_info, path, ssh_key_file)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 794, in _k8s_get_credentials_internal
    '.kube/config', path_candidate, key_filename=ssh_key_file)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/azure/cli/command_modules/acs/acs_client.py", line 72, in secure_copy
    ssh.connect(host, username=user, pkey=pkey, sock=proxy)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/client.py", line 385, in connect
    t.start_client(timeout=timeout)
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/transport.py", line 543, in start_client
    raise e
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/transport.py", line 1854, in run
    self._check_banner()
  File "/usr/local/Cellar/azure-cli/2.0.20/libexec/lib/python3.6/site-packages/paramiko/transport.py", line 2005, in _check_banner
    'Error reading SSH protocol banner' + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

@antoineco
Copy link

@jamoham that's a different issue (socket.timeout). Sounds like your Kubernetes master is unreachable, try to establish a SSH connection using plain OpenSSH to confirm that (ssh [email protected]).

@sharmagaurav03
Copy link

Hello,
I am still getting the below issue:

az aks get-credentials --resource-group xxxxxx-01 --name xxxxxx
'users'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/core/commands/init.py", line 337, in execute
six.reraise(*sys.exc_info())
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/six.py", line 693, in reraise
raise value
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/core/commands/init.py", line 311, in execute
result = cmd(params)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/core/commands/init.py", line 170, in call
return super(AzCliCommand, self).call(*args, **kwargs)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/knack/commands.py", line 109, in call
return self.handler(*args, **kwargs)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/core/init.py", line 421, in default_command_handler
result = op(**command_args)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1482, in aks_get_credentials
_print_or_merge_credentials(path, kubeconfig)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1895, in _print_or_merge_credentials
merge_kubernetes_configurations(path, temp_path)
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1012, in merge_kubernetes_configurations
_handle_merge(existing, addition, 'users')
File "/usr/local/Cellar/azure-cli/2.0.41/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 969, in _handle_merge
if existing[key] is None:
KeyError: 'users'

@troydai
Copy link
Contributor

troydai commented Jul 12, 2018

@sharmagaurav03 this is likely a different issue. Please open an new issue.

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@haroldrandom haroldrandom added ACS az acs/aks/openshift bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team. labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACS az acs/aks/openshift bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests