We have created a self managed kubernetes cluster using the kubeadm approach. It is a 3 node cluster hosted on AWS EC2 instances (1-Master and 2-Slaves).
We have created a separate NGINX server to route the requests for different applications deployed on K8S cluster.
This NGINX server is linked to AWS ALB along with an openssl self-signed certificate so that the Cluster is accessible only via HTTPS Listener PORT i.e. 443.
Also, we have linked one separate ALB with K8S Master to access K8S Dashboard / K8S Api Server.
We are using Jenkins to create jobs for automated deployment in K8S cluster. However, when we run the job intermittently we get TLS handshake timeout.
For instance:- if we run below command:
kubectl get pods --insecure-skip-tls-verify=true
We get an error:
Unable to connect to the server: net/http: TLS handshake timeout
On multiple re-runs the command runs successfully.
We are using the latest version of Kubernetes i.e. 1.15 version
We have been struggling to find a permanent solution to this.
How can I fix it?
kube-apiserver
. Make sure that the pod is not restarting (kubectl get po --namespace=kube-system
), and take a look at the logs to find out a possible cause. Update your question with the info to get further help. This error is also susceptible if your instance is under high CPU pressure, or if there is a proxy capturing packets of yourkubectl
requests.{"log":"I0919 10:38:50.217420 1 log.go:172] http: TLS handshake error from 172.22.84.126:58618: remote error: tls: bad certificate\n","stream":"stderr","time":"2019-09-19T10:38:50.217736958Z"} {"log":"E0919 10:44:50.020653 1 watcher.go:214] watch chan error: etcdserver: mvcc: required revision has been compacted\n","stream":"stderr","time":"2019-09-19T10:44:50.020957098Z"}