question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az acs kubernetes get-credentials needs appended 'mgmt' to DNS prefix

See original GitHub issue

When 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:closed
  • Created 7 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alex88commented, Jan 26, 2017

Oh I see, I’ve

azure-cli (0.1.1b2)
acr (0.1.1b1)
acs (0.1.1b1)

anyway, I’ve downloaded the config file from the master machine and it’s now working, thanks

1reaction
jesushernandezcommented, Jan 4, 2017

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Container Service for Kubernetes clusters
Azure Container Service simplifies creation, configuration, and management of clusters configured to run containerized applications.
Read more >
Restrict egress traffic in Azure Kubernetes Service (AKS)
Important. This document covers only how to lock down the traffic leaving the AKS subnet. AKS has no ingress requirements by default.
Read more >
A story, born in the Cloud (Part 3): Windows Containers on ...
Easy to deploy with general knowledge about Kubernetes. The cluster “doesn't mind” to run with a single master node, although at least three...
Read more >
opal-azure-cli-acs - PyPI
2.1.1. Updated options of az aks use-dev-spaces command. Added –update support. az aks get-credentials –admin ...
Read more >
Setup Kubernetes Ingress with SSL-Passthrough - Azure Talk
Now we want to set up a Kubernetes cluster, configure an ingress service and enable the SSL ... az acs kubernetes get-credentials ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found