{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-cli/issues/1618","repository_url":"https://api.github.com/repos/Azure/azure-cli","labels_url":"https://api.github.com/repos/Azure/azure-cli/issues/1618/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-cli/issues/1618/comments","events_url":"https://api.github.com/repos/Azure/azure-cli/issues/1618/events","html_url":"https://github.com/Azure/azure-cli/issues/1618","id":197682385,"number":1618,"title":"az acs kubernetes get-credentials needs appended 'mgmt' to DNS prefix","user":{"login":"DonMartin76","id":7326883,"avatar_url":"https://avatars.githubusercontent.com/u/7326883?v=3","gravatar_id":"","url":"https://api.github.com/users/DonMartin76","html_url":"https://github.com/DonMartin76","followers_url":"https://api.github.com/users/DonMartin76/followers","following_url":"https://api.github.com/users/DonMartin76/following{/other_user}","gists_url":"https://api.github.com/users/DonMartin76/gists{/gist_id}","starred_url":"https://api.github.com/users/DonMartin76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DonMartin76/subscriptions","organizations_url":"https://api.github.com/users/DonMartin76/orgs","repos_url":"https://api.github.com/users/DonMartin76/repos","events_url":"https://api.github.com/users/DonMartin76/events{/privacy}","received_events_url":"https://api.github.com/users/DonMartin76/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-27T10:30:38Z","updated_at":"2016-12-28T16:23:35Z","closed_at":null,"body":"When using the command from [the Kubernetes tutorial](https://docs.microsoft.com/de-de/azure/container-service/container-service-kubernetes-walkthrough) 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\r\n\r\n`az acs kubernetes get-credentials --dns-prefix=<...>`\r\n\r\nare 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.\r\n\r\n**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>`.\r\n\r\nThe error message you get otherwise is just this (here on macOS Sierra):\r\n\r\n```bash\r\n[Errno 8] nodename nor servname provided, or not known\r\nTraceback (most recent call last):\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/main.py\", line 34, in main\r\n    cmd_result = APPLICATION.execute(args)\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/core/application.py\", line 139, in execute\r\n    result = expanded_arg.func(params)\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/core/commands/__init__.py\", line 275, in _execute_command\r\n    result = op(client, **kwargs) if client else op(**kwargs)\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/command_modules/acs/custom.py\", line 477, in k8s_get_credentials\r\n    '.kube/config', path_candidate)\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/azure/cli/command_modules/acs/acs_client.py\", line 21, in SecureCopy\r\n    ssh.connect(host, username=user, key_filename=os.path.join(home, '.ssh', 'id_rsa'))\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/paramiko/client.py\", line 296, in connect\r\n    to_try = list(self._families_and_addresses(hostname, port))\r\n  File \"/Users/myuser/Library/Python/2.7/lib/python/site-packages/paramiko/client.py\", line 200, in _families_and_addresses\r\n    addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)\r\ngaierror: [Errno 8] nodename nor servname provided, or not known\r\n```\r\n\r\nI also tried the client in docker (which uses Python 3.5); there the error message looks like this:\r\n\r\n```bash\r\n[Errno -2] Name does not resolve\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.5/site-packages/azure/cli/main.py\", line 34, in main\r\n    cmd_result = APPLICATION.execute(args)\r\n  File \"/usr/local/lib/python3.5/site-packages/azure/cli/core/application.py\", line 142, in execute\r\n    result = expanded_arg.func(params)\r\n  File \"/usr/local/lib/python3.5/site-packages/azure/cli/core/commands/__init__.py\", line 275, in _execute_command\r\n    result = op(client, **kwargs) if client else op(**kwargs)\r\n  File \"/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acs/custom.py\", line 511, in k8s_get_credentials\r\n    '.kube/config', path_candidate)\r\n  File \"/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acs/acs_client.py\", line 21, in SecureCopy\r\n    ssh.connect(host, username=user, key_filename=os.path.join(home, '.ssh', 'id_rsa'))\r\n  File \"/usr/local/lib/python3.5/site-packages/paramiko/client.py\", line 296, in connect\r\n    to_try = list(self._families_and_addresses(hostname, port))\r\n  File \"/usr/local/lib/python3.5/site-packages/paramiko/client.py\", line 200, in _families_and_addresses\r\n    addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)\r\n  File \"/usr/local/lib/python3.5/socket.py\", line 732, in getaddrinfo\r\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\r\nsocket.gaierror: [Errno -2] Name does not resolve\r\n```\r\n\r\nSo 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.\r\n\r\n**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."},"comment":{"url":"https://api.github.com/repos/Azure/azure-cli/issues/comments/269500568","html_url":"https://github.com/Azure/azure-cli/issues/1618#issuecomment-269500568","issue_url":"https://api.github.com/repos/Azure/azure-cli/issues/1618","id":269500568,"user":{"login":"jesushernandez","id":1518273,"avatar_url":"https://avatars.githubusercontent.com/u/1518273?v=3","gravatar_id":"","url":"https://api.github.com/users/jesushernandez","html_url":"https://github.com/jesushernandez","followers_url":"https://api.github.com/users/jesushernandez/followers","following_url":"https://api.github.com/users/jesushernandez/following{/other_user}","gists_url":"https://api.github.com/users/jesushernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/jesushernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jesushernandez/subscriptions","organizations_url":"https://api.github.com/users/jesushernandez/orgs","repos_url":"https://api.github.com/users/jesushernandez/repos","events_url":"https://api.github.com/users/jesushernandez/events{/privacy}","received_events_url":"https://api.github.com/users/jesushernandez/received_events","type":"User","site_admin":false},"created_at":"2016-12-28T16:23:35Z","updated_at":"2016-12-28T16:23:35Z","body":"I also noticed this. If the cluster is created via the portal, `mgmt` needs to be appended to your dns prefix when specifying `--dns-prefix` in `az acs kubernetes get-credentials`. What's a reasonable fix for this? There's a bit of inconsistency between the docs, what the portal does and what the cli does."}}
{"actor":{"display_login":"jesushernandez"}}