az acs kubernetes get-credentials needs appended 'mgmt' to DNS prefix
See original GitHub issueWhen using the command from the Kubernetes tutorial to get credentials, it should be mentioned that the DNS prefix you specify when creating the container service and the one you need to specify when doing
az acs kubernetes get-credentials --dns-prefix=<...>
are not the same; it seems you must append mgmt
to the latter. E.g., I create a Kubernetes Cluster with DNS prefix mykube
, then I need to get the credentials using --dns-prefix=mykubemgmt
, which is rather confusing.
Important: I created my Kubernetes cluster using the Portal directly, not via the az
command line tooling (including creating my own Service Principal and such). This also means that my acs
name was prefixed with containerservice-<what I wrote>
.
The error message you get otherwise is just this (here on macOS Sierra):
[Errno 8] nodename nor servname provided, or not known
Traceback (most recent call last):
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/main.py", line 34, in main
cmd_result = APPLICATION.execute(args)
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/core/application.py", line 139, in execute
result = expanded_arg.func(params)
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/core/commands/__init__.py", line 275, in _execute_command
result = op(client, **kwargs) if client else op(**kwargs)
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/command_modules/acs/custom.py", line 477, in k8s_get_credentials
'.kube/config', path_candidate)
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/command_modules/acs/acs_client.py", line 21, in SecureCopy
ssh.connect(host, username=user, key_filename=os.path.join(home, '.ssh', 'id_rsa'))
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/paramiko/client.py", line 296, in connect
to_try = list(self._families_and_addresses(hostname, port))
File "/Users/myuser/Library/Python/2.7/lib/python/site-packages/paramiko/client.py", line 200, in _families_and_addresses
addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
gaierror: [Errno 8] nodename nor servname provided, or not known
I also tried the client in docker (which uses Python 3.5); there the error message looks like this:
[Errno -2] Name does not resolve
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/azure/cli/main.py", line 34, in main
cmd_result = APPLICATION.execute(args)
File "/usr/local/lib/python3.5/site-packages/azure/cli/core/application.py", line 142, in execute
result = expanded_arg.func(params)
File "/usr/local/lib/python3.5/site-packages/azure/cli/core/commands/__init__.py", line 275, in _execute_command
result = op(client, **kwargs) if client else op(**kwargs)
File "/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acs/custom.py", line 511, in k8s_get_credentials
'.kube/config', path_candidate)
File "/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acs/acs_client.py", line 21, in SecureCopy
ssh.connect(host, username=user, key_filename=os.path.join(home, '.ssh', 'id_rsa'))
File "/usr/local/lib/python3.5/site-packages/paramiko/client.py", line 296, in connect
to_try = list(self._families_and_addresses(hostname, port))
File "/usr/local/lib/python3.5/site-packages/paramiko/client.py", line 200, in _families_and_addresses
addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
File "/usr/local/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
So either this is a documentation thing, or the behavior of the az
cli tool has changed, or both. Right now, I’d say it’s confusing.
Update: It works (with the changes I made in a PR) if you create the cluster using the az
command line; so it seems the Container Services UI in the portal uses a different template than the az
command line does.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (1 by maintainers)
Top GitHub Comments
Oh I see, I’ve
anyway, I’ve downloaded the config file from the master machine and it’s now working, thanks
The confusing part for me was the documentation, so 👍 (disclaimer: I can’t test that command right now, but I believe it just works as stated in the new documentation).