mmumshad / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way on Vagrant on Local Machine. No scripts.
Apache License 2.0
4.7k stars 4.54k forks source link

Error: context deadline exceeded #33

Closed myers-dev closed 2 years ago

myers-dev commented 5 years ago

vagrant@master-1:~$ sudo ETCDCTL_API=3 etcdctl member list --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.crt --cert=/etc/etcd/etcd-server.crt --key=/etc/etcd/et cd-server.key Error: context deadline exceeded

What could be the reason for above error ?

nestorreveron commented 5 years ago

ETCDCTL_API=3 etcdctl --endpoints https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key /etc/kubernetes/pki/etcd/healthcheck-client.key snapshot save ./snapshot.db

You need to put at the end: snapshot save ./snapshot.db

myers-dev commented 5 years ago

same error

vagrant@master-1:~$ sudo ETCDCTL_API=3 etcdctl member list --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.crt --cert=/etc/etcd/etcd-server.crt --key=/etc/etcd/etcd-server.key snapshot save ./snapshot.db --debug ETCDCTL_CACERT=/etc/etcd/ca.crt ETCDCTL_CERT=/etc/etcd/etcd-server.crt ETCDCTL_COMMAND_TIMEOUT=5s ETCDCTL_DEBUG=true ETCDCTL_DIAL_TIMEOUT=2s ETCDCTL_DISCOVERY_SRV= ETCDCTL_ENDPOINTS=[https://127.0.0.1:2379] ETCDCTL_HEX=false ETCDCTL_INSECURE_DISCOVERY=true ETCDCTL_INSECURE_SKIP_TLS_VERIFY=false ETCDCTL_INSECURE_TRANSPORT=true ETCDCTL_KEEPALIVE_TIME=2s ETCDCTL_KEEPALIVE_TIMEOUT=6s ETCDCTL_KEY=/etc/etcd/etcd-server.key ETCDCTL_USER= ETCDCTL_WRITE_OUT=simple INFO: 2019/09/03 19:30:30 ccBalancerWrapper: updating state and picker called by balancer: IDLE, 0xc420137680 INFO: 2019/09/03 19:30:30 dialing to target with scheme: "" INFO: 2019/09/03 19:30:30 could not get resolver for scheme: "" INFO: 2019/09/03 19:30:30 balancerWrapper: is pickfirst: false INFO: 2019/09/03 19:30:30 balancerWrapper: got update addr from Notify: [{127.0.0.1:2379 }] INFO: 2019/09/03 19:30:30 ccBalancerWrapper: new subconn: [{127.0.0.1:2379 0 }] INFO: 2019/09/03 19:30:30 balancerWrapper: handle subconn state change: 0xc420153af0, CONNECTING INFO: 2019/09/03 19:30:30 ccBalancerWrapper: updating state and picker called by balancer: CONNECTING, 0xc420137680 Error: context deadline exceeded

tangduoling commented 5 years ago

I installed ETCD on Windows, and the same problem occurred when I do this:"etcdctl put hello world".Does anyone know how to slove this problem,thanks.

rocket357 commented 4 years ago

I had the same issue due to a typo in my etcd certificate generation command that I didn't notice. If you "sudo systemctl stop etcd", then run "/usr/local/bin/etcd --debug $OPTIONS", where OPTIONS is all of the options listed in the systemd unit file (/etc/systemd/system/etcd), you should get some relevant output. Mine was certificate failures due to missing IP SAN information in the certificate (due to the typo).

Re-generating the certificate (properly) and copying it to the correct locations and restarting etcd fixed the issue for me.

Ardneliahs commented 4 years ago

In my case, it was the firewalld on the hosts, it worked after I turned it off.

gkdg commented 3 years ago

context deadline exceeded error is quite general. I suggest to look first the status of the etcd.service to confirm that the error is not coming due to service configuration error as such service etcd status. If the service is not in active status most probably the problem is in the systemd unit file of the service related to misconfiguration. To confirm the bootstrap error of the service do sudo cat /var/log/syslog If the error is couldn't find local name change the name of the initial cluster with the hostname as such --initial-cluster ${ETCD_NAME}=https://:2380 (assuming following the instructions you stored the hostname in a variable called ETCD_NAME)