Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az connectedk8s connect results in an error but kubectl works fine on local #4529

Open
munishm opened this issue Mar 15, 2022 · 12 comments
Open
Labels
Auto-Assign Auto assign by bot Connected Kubernetes needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team.

Comments

@munishm
Copy link

munishm commented Mar 15, 2022

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.

@ghost ghost added Auto-Assign Auto assign by bot CXP Attention This issue is handled by CXP team. Machine Learning extension/ml Connected Kubernetes labels Mar 15, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 15, 2022

route to CXP team

@navba-MSFT
Copy link
Contributor

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

@navba-MSFT navba-MSFT added the needs-author-feedback More information is needed from author to address the issue. label Mar 17, 2022
@navba-MSFT
Copy link
Contributor

navba-MSFT commented Mar 20, 2022

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

@munishm
Copy link
Author

munishm commented Mar 21, 2022

Hello @navba-MSFT, Thank you for reaching out.

Getting the same error even after the upgrade. Attaching the verbose log file:

connectk8sError.txt

@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Mar 21, 2022
@navba-MSFT
Copy link
Contributor

navba-MSFT commented Mar 21, 2022

@munishm Thanks for getting back. I found another similar issue and it is still open. Azure/azure-cli#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.

@navba-MSFT navba-MSFT added needs-author-feedback More information is needed from author to address the issue. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels Mar 21, 2022
@navba-MSFT
Copy link
Contributor

@munishm A quick follow-up on this to check if you had a chance to look at the above comment. Awaiting your reply.

@munishm
Copy link
Author

munishm commented Mar 24, 2022

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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tpFVk1CTUdBMVVFQXd3TU1UQXVNVFV5TGpFNE15NHhNSUlCSWpBTkJna3Foa2lHCjl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyUkpQR09SeGxPaVB5RndIaEZxSlFHd3NOV1JzaytObFIrdlYKRFIwSS9PcWFHTC80clBZcWkyazZ0QUk3QzEyZkhLMDdzcFNIS0NxN3ZwbnVTVURJLzNmd1lKUmYzWVdoZUlVSwpKdjdXSUEwV241Ry91U0I5TStGVWRJYlFTY29DNytRZERLdjVya292d1NrMjNSaTY0d1FpUUtqMU85MERid0NMCjZRc0ZQQ1hXdGJxdzRXVGQ1ak5HaEJOU1NzdUtZdWV5RHFrZlZpSTZXalFIMW9Wa1N5MGRSOWVJRG9WT21GU04KalUxcmFUd1JpZU41alViUGQ5TkQwdFRyd09EMTdwaHhlN3JkODBrK3U3cFpXT2lNUWEvNktQTXNnbEhHbzFnTQpkUm1Hdkl1MExFdk83ZnV1dkRvTWVheE1kbG1mTHVpNExLNnF3aFM2UkdwNTQxcU9pUUlEQVFBQm8xTXdVVEFkCkJnTlZIUTRFRmdRVUI1ait3cFN3ZUFpc0xNMGRLNitsZzdydUg2OHdId1lEVlIwakJCZ3dGb0FVQjVqK3dwU3cKZUFpc0xNMGRLNitsZzdydUg2OHdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQwpBUUVBUmFpWjRkYmE3a0xNUmlIQmpxRkZMK21la3BWMG5NUE1YZVA2eVpLMEFLZnJWOVlNb2lZdUtNa0l6WGxoCkRkNTVjaVA2YzhFemJOa2I5TGZLNTJib0hTWjRQQlRwdnNmVmU1SkplZmRWbEFSUzdkZjh1SFl6eHF4TEhBRVEKdVNjcFNXVGhBRnhaTU9UdzBGL3I0ekhMeEppYVFrM2ZuSU1oU0podks3NHJWbkFXaGt4Qk1tS2l4YnpoREZELwppQU1TVldxWFFodDR2anFvRmRobkdDV1pFY1RyTUhwMWtrVlJpNGRhcTVxV3Q0OHkySnZrSzI0WkRtNStMYkNUClRCTUNhNUg1UDkxejAxREJOUlRDM3RLbENpN3hudDdPQ1BHaHZBdmFwVUVkbDN2eTY3TUpOcGlCQXZYNnN2OEIKcjN5QVk2R1FCb3owV3FxZzFYWkVJRk1ZOEE9URS0tLS0tCg==
    server: https://172.23.9.13:16443
  name: microk8s-cluster
contexts:
- context:
    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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrakNDQVRlZ0F3SUJBZ0lJVDgvVDJZK3VMaEV3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjh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FRSC9CQVV3QXdFQi96QWRCZ05WSFE0RUZnUVVzNW1taktsYTFZeDZiWEZ2QkFRdApHdDZ0OE5Bd0NnWUlLb1pJemowRUF3SURSd0F3UkFJZ0hBTk9lWllxdnAzVmFWZlF0NFE0bDNQbVkxTFBVcktYClFlWlJ5K2NYd3ZJQ0lHeGRYQ1hUcGlSRCtOeUlLYzQvRXc1aUh0ZkRKS3JyOGV0TDU5L01yRkJ1Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    client-key-data: LS0tLS1CRUdJTiBFIEtFWS0tLS0tCk1IY0NBUUVFSUpHQXFkbGZHdHdXMk5EdWJYckdCVFdvenhNWHZWTDVVemdCam9OaXNMbDdvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFclhwTThTbHlHdDV1am5VRWlMTG5KbDJrK05MeTNqVVpmSE14SzdXYXhwSVBVS2hiS1NGcwpBOXlkelEzaXZlM1J0QnpNbGVvekhJb05sTThnZlRmcDdnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=

@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Mar 24, 2022
@navba-MSFT navba-MSFT added the Service Attention This issue is responsible by Azure service team. label Mar 24, 2022
@ghost
Copy link

ghost commented Mar 24, 2022

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:

Service Attention, needs-team-attention, Connected Kubernetes, CXP Attention, Auto-Assign

Milestone: -

@navba-MSFT
Copy link
Contributor

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

@navba-MSFT navba-MSFT removed the CXP Attention This issue is handled by CXP team. label Mar 24, 2022
@navba-MSFT navba-MSFT removed their assignment Mar 25, 2022
@munishm
Copy link
Author

munishm commented Apr 5, 2022

@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?

@tsc-buddy
Copy link

@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

@msuleman92
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Connected Kubernetes needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

5 participants