Azure/ACS

Error when retrieving credentials: No such file or directory: '/home/myname/.ssh/config

Closed this issue · 2 comments

Is this a request for help?: No


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm) Kubernetes

What happened:
The cluster is created successfully. But when I try to get credentials using the below command:

az acs kubernetes get-credentials --resource-group myResourceGroup --name clusterName

I get the below exception:

[Errno 2] No such file or directory: '/home/myname/.ssh/config' Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main cmd_result = APPLICATION.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/application.py", line 212, in execute result = expanded_arg.func(params) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__ return self.handler(*args, **kwargs) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 620, in _execute_command reraise(*sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise raise value File "/opt/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 "/opt/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 "/opt/az/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 "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/acs_client.py", line 63, in secure_copy conf.parse(open(ssh_config_file)) FileNotFoundError: [Errno 2] No such file or directory: '/home/myname/.ssh/config'

What you expected to happen:
Successfully retrieve credentials

How to reproduce it (as minimally and precisely as possible):
create a cluster using azure cli by following instrusctions on Azure docs. Then follow the same instructions in the below link to retrieve credentials and you will get the error.

https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-kubernetes-walkthrough

Anything else we need to know:

You need to supply the ssh private key in order to download kubeconfig from the cluster:
az acs kubernetes get-credentials -n $cluster -g $resourceGroup --ssh-key-file /path/to/ssh_private_key
when --ssh-key-file is absent, the cli expects the ssh private key to be at ~/.ssh/id_rsa.

The private key is present, but the error is not related to the private key. It is looking for some config file (Please see the error I pasted).

This might be an issue with Azure CLI

Azure/azure-cli#4730