azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Weird kubectl output after `az aks get-credentials`

Open apjanke opened this issue 8 years ago • 1 comments

Describe the bug

I've been going back and forth between Azure and Google Kubernetes Engine creating and destroying k8s clusters tonight, so I don't know whose "fault" this is. But after creating an instance with az and getting the credentials, kubectl is spewing some weird data conversion nonsense at me.

$ az aks create --resource-group=kuar --name=kuar-cluster --node-count=1
[...]
$ az aks get-credentials --resource-group=kuar --name=kuar-cluster
Merged "kuar-cluster" as current context in /Users/janke/.kube/config
$ kubectl get componentstatuses
error: Error loading config file "/Users/janke/.kube/config": error converting *[]NamedCluster into *map[string]*api.Cluster: duplicate name "kuar-cluster" in list: [{gke_kuar-test2_us-west1-a_kuar-cluster {https://35.233.214.238 false  [45 45 45 45 45 66 69 71 73 78 32 67 69 82 84 73 70 73 67 65 84 69 45 45 45 45 45 10 77 73 73 68 67 122 67 67 65 102 79 103 65 119 73 66 65 103 73 81 90 88 100 110 119 68 88 43 101 112 109 102 73 97 99 108 100 106 78 106 105 84 65 78 66 103 107 113 104 107 105 71 57 119 48 66 65 81 115 70 65 68 65 118 10 77 83 48 119 75 119 89 68 86 81 81 68 69 121 82 109 77 106 108 107 89 50 78 106 77 67 48 49 79 68 74 106 76 84 82 104 77 122 103 116 79 68 108 109 78 121 48 122 78 106 100 105 78 68 77 49 89 109 90 107 77 109 77 119 10 72 104 99 78 77 84 103 119 79 68 69 51 77 68 77 49 78 84 85 50 87 104 99 78 77 106 77 119 79 68 69 50 77 68 81 49 78 84 85 50 87 106 65 118 77 83 48 119 75 119 89 68 86 81 81 68 69 121 82 109 77 106 108 107 10 89 50 78 106 77 67 48 49 79 68 74 106 76 84 82 104 77 122 103 116 79 68 108 109 78 121 48 122 78 106 100 105 78 68 77 49 89 109 90 107 77 109 77 119 103 103 69 105 77 65 48 71 67 83 113 71 83 73 98 51 68 81 69 66 10 65 81 85 65 65 52 73 66 68 119 65 119 103 103 69 75 65 111 73 66 65 81 67 98 78 105 43 114 77 111 65 107 113 47 75 49 86 97 97 80 98 85 87 89 102 76 110 83 110 105 68 51 47 111 88 71 72 68 53 51 81 52 118 78 10 54 109 84 81 72 111 106 119 74 56 100 104 122 67 117 105 68 111 100 76 78 117 79 57 66 106 104 74 73 80 111 105 113 115 87 121 82 113 121 77 89 57 52 112 51 72 113 70
[...]
65 84 69 45 45 45 45 45 10] []}} {kuar-cluster {https://kuar-clust-kuar-ef4a67-2447ec30.hcp.eastus.azmk8s.io:443 false  [45 45 45 45 45 66 69 71 73 78 32 67 69 82 84 73 70 73 67 65 84 69 45 45 45 45 45 10 77 73 73 69 121 68 67 67 65 114 67 103 65 119 73 66 65 103 73 82 65 74 117 85 79 110 103 76 53 55 67 82 106 105 81 98 76 107 65 115 86 113 107 119 68 81 89 74 75 111 90 73 104 118 99 78 65 81 69 76 66 81 65 119 10 68 84 69 76 77 65 107 71 65 49 85 69 65 120 77 67 89 50 69 119 72 104 99 78 77 84 103 119 79 68 69 50 77 106 77 48 79 68 73
[... and then *lots* more numbers and a bit of JSON structure ...]
122 87 109 54 82 120 51 43 72 118 122 79 86 67 85 100 115 120 100 78 121 113 90 90 105 53 81 115 83 84 113 108 120 54 88 48 83 100 56 113 105 114 86 102 109 75 67 115 53 114 102 82 112 70 121 76 85 113 110 107 105 112 70 76 10 80 69 76 49 82 98 112 66 50 65 74 102 120 69 117 110 102 110 100 104 67 105 83 117 48 50 75 57 77 117 107 82 73 54 74 118 106 107 69 56 75 47 97 49 72 70 68 89 97 78 112 87 110 55 109 102 72 102 43 73 65 81 113 117 10 110 115 48 114 112 101 97 116 113 112 54 90 97 100 52 97 73 98 102 54 52 71 107 100 57 118 103 119 80 69 79 57 48 113 119 80 52 103 61 61 10 45 45 45 45 45 69 78 68 32 67 69 82 84 73 70 73 67 65 84 69 45 45 45 45 45 10] []}}]

Does anyone know what might be causing this?

The gke_kuar-test2_us-west1-a_kuar-cluster at the beginning looks like a Google name; maybe I'm barking up the wrong tree here? Or should az aks get-credentials be validating the ~/.kube/config before merging data in to it? The Azure-looking names look like they're similar in structure.

To Reproduce

Sorry I don't have a specific reproducer, but:

  • Alternate between:
  • gcloud container clusters create kuar-cluster / gcloud container clusters delete kuar-cluster
  • az aks create --resource-group=kuar --name=kuar-cluster --node-count=1 / az aks get-credentials --resource-group=kuar --name=kuar-cluster / Delete the Resource Groups in Azure Portal

Expected behavior

Expected a normal kubectl output listing the manager things and a Healthy/Unhealthy status for each.

Environment summary

macOS 10.13.6 Installed via brew install azure-cli zsh 5.5.1

azure-cli (2.0.44)

acr (2.1.3)
acs (2.3.0)
advisor (0.6.0)
ams (0.2.2)
appservice (0.2.2)
backup (1.2.0)
batch (3.3.2)
batchai (0.4.1)
billing (0.2.0)
cdn (0.1.0)
cloud (2.1.0)
cognitiveservices (0.2.0)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.3)
core (2.0.44)
cosmosdb (0.2.0)
dla (0.2.1)
dls (0.1.0)
dms (0.1.0)
eventgrid (0.2.0)
eventhubs (0.2.2)
extension (0.2.1)
feedback (2.1.4)
find (0.2.12)
interactive (0.3.28)
iot (0.3.0)
iotcentral (0.1.0)
keyvault (2.2.2)
lab (0.1.0)
maps (0.3.1)
monitor (0.2.2)
network (2.2.3)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.0)
redis (0.3.0)
relay (0.1.0)
reservations (0.3.1)
resource (2.1.2)
role (2.1.3)
search (0.1.1)
servicebus (0.2.1)
servicefabric (0.1.1)
sql (2.1.2)
storage (2.2.0)
telemetry (1.0.0)
vm (2.2.1)

Python location '/usr/local/opt/python/bin/python3.7'
Extensions directory '/Users/janke/.azure/cliextensions'

Python (Darwin) 3.7.0 (default, Jun 29 2018, 20:13:13) 
[Clang 9.1.0 (clang-902.0.39.2)]

apjanke avatar Aug 17 '18 06:08 apjanke

https://github.com/kubernetes/kubernetes/issues/66435

neumanndaniel avatar Sep 13 '18 06:09 neumanndaniel