AKS icon indicating copy to clipboard operation
AKS copied to clipboard

az aks and kubectl issue: Unable to connect to the server: net/http: TLS handshake timeout

Open chetanku opened this issue 8 years ago • 52 comments

I am trying to connect to my existing Kuberentes cluster from Windows 2016 Server. 1st issue: On windows 2016 server, I run az aks get-credentials with resource group and cluster name, I see an issue with the case. If I specify my cluster name as --name=testscluster and run it, It somehow changes the case to testScluster.

2nd Issue: Then after I run kubectl get nodes I get Unable to connect to the server: net/http: TLS handshake timeout . I manually changed the case and tried but still the same issue.

When I try to do the same from Ubuntu server it works completely fine. Question: Does aks support windows ? or is it for only Linux? I am on latest az version of 2.0.26.

Any help will be great!!

chetanku avatar Feb 04 '18 19:02 chetanku

Running into the same issue on Mac OS. The kubectl command was working fine just yesterday, and now throws an error:

~ $ kubectl get nodes
Unable to connect to the server: net/http: TLS handshake timeout

I've tried upgrading the cluster, but that also throws an error and puts the cluster into a failed state:

~ $ az aks upgrade --resource-group my-resource-group --name my-aks-cluster --kubernetes-version 1.8.7
Kubernetes may be unavailable during cluster upgrades.
Are you sure you want to perform this operation? (y/n): y
Deployment failed. Correlation ID: some-id-here. Internal server error

matkam avatar Feb 06 '18 19:02 matkam

~ $ kubectl get nodes Unable to connect to the server: net/http: TLS handshake timeout Can you try deleting the context and getting it again? this helped me fix it.

chetanku avatar Feb 06 '18 19:02 chetanku

Still the same:

~ $ rm /Users/matt/.kube/config
~ $ az aks get-credentials --resource-group xxx --name xxx
Merged "xxx" as current context in /Users/xxx/.kube/config
~ $ kubectl get nodes
Unable to connect to the server: net/http: TLS handshake timeout

matkam avatar Feb 06 '18 19:02 matkam

Is your cluster up and functional or it is in a failed state? Can you also check the fqdn of the cluster in the config and match it with azure portal?

@jchauncey

chetanku avatar Feb 06 '18 19:02 chetanku

It is in a failed state. But I can't tell if that's from the failed upgrade, or if it was failing earlier. The previously set up services/pods seem to work still.

matkam avatar Feb 06 '18 19:02 matkam

@matkam what region is this in?

cc @mboersma

jchauncey avatar Feb 06 '18 20:02 jchauncey

@jchauncey Central US

matkam avatar Feb 06 '18 20:02 matkam

can you try upgrading it again?

https://kubernetes.io/docs/tasks/administer-cluster/kubeadm-upgrade-1-8/#recovering-from-a-bad-state

If kubeadm upgrade somehow fails and fails to roll back, due to an unexpected shutdown during execution for instance, you may run kubeadm upgrade again as it is idempotent and should eventually make sure the actual state is the desired state you are declaring.

You can use kubeadm upgrade to change a running cluster with x.x.x --> x.x.x with --force, which can be used to recover from a bad state.

chetanku avatar Feb 06 '18 20:02 chetanku

How does kubeadm work with AKS? I have been using az aks upgrade to perform upgrades, but there is no --force option there.

matkam avatar Feb 06 '18 20:02 matkam

Sorry, Can you try upgrading it again with az aks upgrade?

az aks upgrade --name myAKSCluster --resource-group myResourceGroup --kubernetes-version 1.8.7

chetanku avatar Feb 06 '18 22:02 chetanku

I've tried the upgrade several times with the same result:

~ $ az aks upgrade --resource-group xxx --name xxx --kubernetes-version 1.8.7
Kubernetes may be unavailable during cluster upgrades.
Are you sure you want to perform this operation? (y/n): y
Deployment failed. Correlation ID: 068b7fae-6d54-41d7-8b2d-0ee308e22674. Internal server error

matkam avatar Feb 06 '18 22:02 matkam

Is your subscription good? do you have enough credits?

https://stackoverflow.com/questions/48443320/upgrade-failed-azure-aks-from-1-8-1-to-1-8-6

chetanku avatar Feb 06 '18 22:02 chetanku

My subscription is good with plenty of credits. I was able to start another AKS cluster.

Output from your linked stackoverflow:

~ $ az aks show --name xxx --resource-group xxx --output table
Name            Location    ResourceGroup              KubernetesVersion    ProvisioningState    Fqdn
--------------  ----------  -------------------------  -------------------  -------------------  -------------------------------------------------------------------
xxx  centralus   xxx  1.8.7                Failed               xxx.hcp.centralus.azmk8s.io
~ $ az aks get-versions --name xxx --resource-group xxx --output table
Name     ResourceGroup              MasterVersion    MasterUpgrades    NodePoolVersion    NodePoolUpgrades
-------  -------------------------  ---------------  ----------------  -----------------  ------------------
default  xxx  1.8.7            1.8.7             1.8.7              1.8.7

matkam avatar Feb 06 '18 22:02 matkam

can you try this on powershell and see if there are any logs. Get-AzureRmLog -CorrelationId "068b7fae-6d54-41d7-8b2d-0ee308e22674"

chetanku avatar Feb 06 '18 22:02 chetanku

Unfortunately not:

PS Azure:\> Get-AzureRmLog -CorrelationId "068b7fae-6d54-41d7-8b2d-0ee308e22674"
WARNING: [Get-AzureRmLog] Parameter deprecation: The DetailedOutput parameter will be deprecated in a future breaking change release.
WARNING: [Get-AzureRmLog] Parameter name change: The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.
WARNING: [Get-AzureRmLog] Output change: The field EventChannels from the EventData object is being deprecated in the release 5.0.0 - November 2017 - since it now returns a constant value (Admin,Operation)
Azure:\

matkam avatar Feb 06 '18 22:02 matkam

I found this on one of the Kubernetes nodes, /var/log/syslog:

Feb  6 23:53:29 aks-nodepool1-12029634-1 docker[1781]: I0206 23:53:29.889440    1867 kubelet_node_status.go:83] Attempting to register node aks-nodepool1-12029634-1
Feb  6 23:53:31 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:31.329906    1867 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443/api/v1/pods?fieldSelector=spec.nodeName%3Daks-nodepool1-12029634-1&resourceVersion=0: net/http: TLS handshake timeout
Feb  6 23:53:31 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:31.330167    1867 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:422: Failed to list *v1.Node: Get https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443/api/v1/nodes?fieldSelector=metadata.name%3Daks-nodepool1-12029634-1&resourceVersion=0: net/http: TLS handshake timeout
Feb  6 23:53:31 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:31.332125    1867 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:413: Failed to list *v1.Service: Get https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443/api/v1/services?resourceVersion=0: net/http: TLS handshake timeout
Feb  6 23:53:32 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:32.964445    1867 eviction_manager.go:238] eviction manager: unexpected err: failed to get node info: node 'aks-nodepool1-12029634-1' not found
Feb  6 23:53:32 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:32.985870    1867 kubelet.go:2095] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
Feb  6 23:53:37 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:37.986996    1867 kubelet.go:2095] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
Feb  6 23:53:39 aks-nodepool1-12029634-1 docker[1781]: E0206 23:53:39.894470    1867 kubelet_node_status.go:107] Unable to register node "aks-nodepool1-12029634-1" with API server: Post https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443/api/v1/nodes: net/http: TLS handshake timeout

matkam avatar Feb 07 '18 00:02 matkam

what version of az are you using? Can you update it to latest and try?

chetanku avatar Feb 07 '18 00:02 chetanku

Version 2.0.26 installed via homebrew

matkam avatar Feb 07 '18 00:02 matkam

throwing in some thoughts: what does az aks list give? are you able to telnet to fqdn:443 ?

@jchauncey @mboersma

chetanku avatar Feb 07 '18 01:02 chetanku

~ $ az aks list
[
  {
    "agentPoolProfiles": [
      {
        "count": 3,
        "name": "nodepool1",
        "osType": "Linux",
        "storageProfile": "ManagedDisks",
        "vmSize": "Standard_D1_v2"
      }
    ],
    "dnsPrefix": "evieAksClu-microserviceReso-51c2f9",
    "fqdn": "evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io",
    "id": "/subscriptions/xxx/resourcegroups/microserviceResourceGroup/providers/Microsoft.ContainerService/managedClusters/evieAksCluster",
    "kubernetesVersion": "1.8.7",
    "linuxProfile": {
      "adminUsername": "xxx",
      "ssh": {
        "publicKeys": [
          {
            "keyData": "xxx"
          }
        ]
      }
    },
    "location": "centralus",
    "name": "evieAksCluster",
    "provisioningState": "Failed",
    "resourceGroup": "microserviceResourceGroup",
    "servicePrincipalProfile": {
      "clientId": "a4c334fc-c226-4e6d-a43d-050e60c6a23e"
    },
    "type": "Microsoft.ContainerService/ManagedClusters"
  }
]
~ $ curl -v https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443
* Rebuilt URL to: https://evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443/
*   Trying 52.173.89.237...
* TCP_NODELAY set
* Connected to evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io (52.173.89.237) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443 
* stopped the pause stream!
* Closing connection 0
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to evieaksclu-microservicereso-51c2f9-4f6fe944.hcp.centralus.azmk8s.io:443 

matkam avatar Feb 07 '18 01:02 matkam