azure-cli-extensions
azure-cli-extensions copied to clipboard
az connectedk8s connect results in an error but kubectl works fine on local
Describe the bug
az connectedk8s connect results in Kube config parsing error but kubctl command works fine on the machine. I can connect to local running Microk8s cluster either via kubectl or k9s. I also parsed the kube config externally to see if there is any issue with the config file but didn't find any discrepancy.
Command Name
az connectedk8s connect Extension Name: connectedk8s. Version: 1.2.5.
Errors:
Problem loading the kubeconfig file.unacceptable character #x0000: special characters are not allowed
in "C:\Users\Administrator/.kube/config", position 3
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az connectedk8s connect --name {} --resource-group {} --location {} --tags {} {}
Expected Behavior
Should be able to connect to local K8s cluster when kubectl is able to connect to it.
Environment Summary
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI
azure-cli 2.30.0 *
azure-cli-ml 1.37.0
Extensions:
azure-cli-ml 1.37.0
connectedk8s 1.2.5
Additional Context
Is there another way where I can get more verbose error information? Thank you.
route to CXP team
@munishm Apologies for the late reply. Could you please use the most recent version of Azure CLI and update the existing connectedk8s extension and then try to connect?
az extension update --name connectedk8s
If the issue resurfaces again, could you please use the --debug
switch and run the same command again and share the output here ? Awaiting your reply.
@munishm I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please follow the above action plan and if that doesn't help, please share the --debug output once you get a chance. Awaiting your reply.
Hello @navba-MSFT, Thank you for reaching out.
Getting the same error even after the upgrade. Attaching the verbose log file:
@munishm Thanks for getting back. I found another similar issue and it is still open. https://github.com/Azure/azure-cli/issues/16619. I understand that using kubectl you can connect and the issue is only with AzCLI. But the below step is just to isolate the issue.
Can you please share the raw contents of your kubeconfig file? Please remove the credentials and other sensitive details. Looks like there's a formatting problem position 3 due to some special character.
To post the content without formatting, type 3 backticks , a newline, then paste your YAML content, followed by a newline and 3 backticks
. See this doc for more details.
@munishm A quick follow-up on this to check if you had a chance to look at the above comment. Awaiting your reply.
Hello @navba-MSFT , Thank you for your reply.
This is the Kube config, sensitive data is modified so it's ok.
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUyTkRjNE5qVTNNall3SGhjTk1qSXdNekl4TVRJeU9EUTJXaGNOTXpJd016RTRNVEl5T0RRMgpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUyTkRjNE5qVTNNall3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFTUHFJc0lDV3h3dThiRGV0WFZXY0ZoOVYwVFFXSUQ3WkxRcjVsUi9HbkkKc0lJejA3WkszNFFyOG80L3VhMDVBTFkxKzRDbUd5bXpKYnpxRVN4WWpnRzFvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVUxjSktsUUNPcVNhWHBjUEplZTVBCnNaT1Y2ZUF3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUloQVByREN4YmtNTE9SeDNyRHhFTUx0Y3RjaWpZZmVub28KN0o0d0RnbUpWcGwrQWlCSU9RVkxVT003NzVMbVFJcDY5RVhxNnFzZXN50tRU5EIENFUlRJRklDQVRFLS0tLS0K
server: https://host.docker.internal:61427
name: k3d-k3s-default
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tpFVk1CTUdBMVVFQXd3TU1UQXVNVFV5TGpFNE15NHhNSUlCSWpBTkJna3Foa2lHCjl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyUkpQR09SeGxPaVB5RndIaEZxSlFHd3NOV1JzaytObFIrdlYKRFIwSS9PcWFHTC80clBZcWkyazZ0QUk3QzEyZkhLMDdzcFNIS0NxN3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cluster: k3d-k3s-default
user: admin@k3d-k3s-default
name: k3d-k3s-default
- context:
cluster: microk8s-cluster
user: admin
name: microk8s
current-context: k3d-k3s-default
kind: Config
preferences: {}
users:
- name: admin
user:
token: UzIrYUZzVU52VGtuak1Rb1Y3eTFRVUdlSVZGTlpTSVJ5VUdMOUF2OG1PMD0K
- name: admin@k3d-k3s-default
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrakNDQVRlZ0F3SUJBZ0lJVDgvVDJZK3VMaEV3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJLMTZUUEVwY2hyZWJvNTEKQklpeTV5WmRwUGpTOHQ0MUdYeHpNU3UxbXNhU0QxQ29XeWtoYkFQY25jME40cjN0MGJRY3pKWHFNeHlLRFpUUApJSDAzNmU2alNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCU3ptYWFNcVZyVmpIcHRjVzhFQkMwYTNxM3cwREFLQmdncWhrak9QUVFEQWdOSkFEQkcKQWlFQXFENVVDTlN3Q2NLb1pEM01qY2tocUJMeUFYY1h4U2NiQUlwZXp0d1dUbk1DSVFDUE56ak50Y0lJd2g5MApCS1pES2ROaUcwV2ViZEhkNDlYVEtWckU3K1dHR2c9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCi0tLS0VSVElGSUNBVEUtLS0tLQpNSUlCZGpDQ0FSMmdBd0lCQWdJQkFEQUtCZ2dxaGtqT1BRUURBakFqTVNFd0h3WURWUVFEREJock0zTXRZMnhwClpXNTBMV05oUURFMk5EYzROalUzTWpZd0hoY05Nakl3TXpJeE1USXlPRFEyV2hjTk16SXdNekU0TVRJeU9EUTIKV2pBak1TRXdId1lEVlFRRERCaHJNM010WTJ4cFpXNTBMV05oUURFMk5EYzROalUzTWpZd1dUQVRCZ2NxaGtqTwpQUUlCQmdncWhrak9QUU1CQndOQ0FBU3BCUkxVUEVoejFqR2IxaE1QMEx6enJPOC9UUHU1T1pUYnRESXBHRzljClZIbFJMdTFqMXc2Q1ByRGlvM1FXbExxa01pS2svREpoKzZRVzZ2Zzk1bU11bzBJd1FEQU9CZ05WSFE4QkFmOEUKQkFNQ0FxUXdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QWRCZ05WSFE0RUZnUVVzNW1taktsYTFZeDZiWEZ2QkFRdApHdDZ0OE5Bd0NnWUlLb1pJemowRUF3SURSd0F3UkFJZ0hBTk9lWllxdnAzVmFWZlF0NFE0bDNQbVkxTFBVcktYClFlWlJ5K2NYd3ZJQ0lHeGRYQ1hUcGlSRCtOeUlLYzQvRXc1aUh0ZkRKS3JyOGV0TDU5L01yRkJ1Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
client-key-data: LS0tLS1CRUdJTiBFIEtFWS0tLS0tCk1IY0NBUUVFSUpHQXFkbGZHdHdXMk5EdWJYckdCVFdvenhNWHZWTDVVemdCam9OaXNMbDdvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFclhwTThTbHlHdDV1am5VRWlMTG5KbDJrK05MeTNqVVpmSE14SzdXYXhwSVBVS2hiS1NGcwpBOXlkelEzaXZlM1J0QnpNbGVvekhJb05sTThnZlRmcDdnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @akashkeshari.
Issue Details
Describe the bug
az connectedk8s connect results in Kube config parsing error but kubctl command works fine on the machine. I can connect to local running Microk8s cluster either via kubectl or k9s. I also parsed the kube config externally to see if there is any issue with the config file but didn't find any discrepancy.
Command Name
az connectedk8s connect Extension Name: connectedk8s. Version: 1.2.5.
Errors:
Problem loading the kubeconfig file.unacceptable character #x0000: special characters are not allowed
in "C:\Users\Administrator/.kube/config", position 3
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az connectedk8s connect --name {} --resource-group {} --location {} --tags {} {}
Expected Behavior
Should be able to connect to local K8s cluster when kubectl is able to connect to it.
Environment Summary
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI
azure-cli 2.30.0 *
azure-cli-ml 1.37.0
Extensions:
azure-cli-ml 1.37.0
connectedk8s 1.2.5
Additional Context
Is there another way where I can get more verbose error information? Thank you.
Author: | munishm |
---|---|
Assignees: | navba-MSFT |
Labels: |
|
Milestone: | - |
@munishm Thanks for getting back. The YAML file looks good to me. I am involving the Service Team right away so that they can look into this issue. On a side note, did you try creating a different (new) kubeconfig file and mention its path in the command and check if that makes any difference ? See below example. Awaiting your reply.
az connectedk8s connect -g resourceGroupName -n connectedClusterName --kube-config /path/to/kubeconfig --kube-context kubeContextName
@akashkeshari Could you please look into this issue and provide an update once you get a chance ? Awaiting your reply.
@akashkeshari Did you get a chance to look into it or may be you can share some pointers on how I can debug and try to resolve it?
@munishm - Are you still experiencing this issue? I have come across the same today when workthrough the jumpstart for MicroK8s. Local kubectl is fine for my microk8s cluster and others. However when i try the az connectedk8s connect i get:
Problem loading the kubeconfig file.unacceptable character #x0000: special characters are not allowed in ".kube\microk8s", position 3
@munishm - Are you still experiencing this issue? I have come across the same today when workthrough the jumpstart for MicroK8s. Local kubectl is fine for my microk8s cluster and others. However when i try the az connectedk8s connect i get:
Problem loading the kubeconfig file.unacceptable character #x0000: special characters are not allowed in ".kube\microk8s", position 3
Hi TSC-Buddy
I got into the same issue when deploying microk8s on locally with the az k8sconnected command what I did to resolve the issue was opened the config file in notepad++ and change the encoding to UTF-8 and it worked all good.
Thanks Hopes this helps everyone.