acs-engine icon indicating copy to clipboard operation
acs-engine copied to clipboard

Failed to start etcd after upgrading k8s 1.6.6 -> 1.7.16

Open hieuhc opened this issue 8 years ago • 8 comments

Is this a request for help?:

--- No

Is this an ISSUE or FEATURE REQUEST? (choose one):

--- ISSUE

What version of acs-engine?:

Version: canary GitCommit: 28eb1d1 GitTreeState: dirty

Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm) Kubernetes 1.7.16

What happened: After upgrading k8s in westeurope location from 1.6.6 to 1.7.16, I couldn't access the cluster:

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

Log from k8s_kube-apiserver_kube-apiserver-k8s-master-***

I0515 12:27:40.017321      69 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0515 12:27:40.017421      69 compact.go:55] compactor already exists for endpoints [https://127.0.0.1:2379]
Error: error waiting for etcd connection: timed out waiting for the condition
Error: error waiting for etcd connection: timed out waiting for the condition

And when I ran systemctl status etcd.service command:

May 15 12:44:25 k8s-master-23051101-0 systemd[1]: Stopped etcd - highly-available key value store.
May 15 12:44:25 k8s-master-23051101-0 systemd[1]: Starting etcd - highly-available key value store...
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: etcd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: Failed to start etcd - highly-available key value store.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: etcd.service: Unit entered failed state.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: etcd.service: Failed with result 'exit-code'.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: etcd.service: Service hold-off time over, scheduling restart.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: Stopped etcd - highly-available key value store.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: etcd.service: Start request repeated too quickly.
May 15 12:44:26 k8s-master-23051101-0 systemd[1]: Failed to start etcd - highly-available key value store.

What you expected to happen: Able to connect to k8s server after upgrading

How to reproduce it (as minimally and precisely as possible): Create a k8s version 1.6.6 with default template (1 master and 3 agent nodes) in westeurope location. Then upgrade to 1.7.16.

Anything else we need to know: Let me know if you need anymore information or log

hieuhc avatar May 15 '18 13:05 hieuhc

@hieuhc what acs-engine version was the cluster built with? Could look if you see anything in sudo journalctl -u etcd -xxx? What happens if you try to restart etcd? sudo systmectl restart etcd

CecileRobertMichon avatar May 16 '18 17:05 CecileRobertMichon

@CecileRobertMichon I didn't keep track of the version of acs-engine used to build this cluster. It was the last July, and I didn't specify k8s version while deploying, so 1.6.6 was the default. Here is output of above commands:

sudo journalctl -u etcd -xxx

- Logs begin at Tue 2018-05-15 11:28:00 UTC, end at Fri 2018-05-18 12:01:48 UTC. --
May 15 11:28:06 k8s-master-23051101-0 systemd[1]: Starting etcd - highly-available key value store...
-- Subject: Unit etcd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit etcd.service has begun starting up.
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: recognized environment variable ETCD_NAME, but unused: shadowed by corresponding flag 
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: recognized environment variable ETCD_DATA_DIR, but unused: shadowed by corresponding flag 
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: etcd Version: 3.2.16
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: Git SHA: 121edf046
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: Go Version: go1.8.5
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: Go OS/Arch: linux/amd64
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: setting maximum number of CPUs to 2, total number of available CPUs is 2
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: found invalid file/dir lost+found under data dir /var/lib/etcddisk (Ignore this if you are upgrading etcd)
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: the server is already initialized as member before, starting as etcd member...
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: peerTLS: cert = /etc/kubernetes/certs/etcdpeer0.crt, key = /etc/kubernetes/certs/etcdpeer0.key, ca = , trusted-ca = /etc/kubernetes/certs/ca.crt, client-cert-auth = t
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: listening for peers on https://10.240.255.5:2380
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: listening for client requests on 10.240.255.5:2379
May 15 11:28:10 k8s-master-23051101-0 etcd[1340]: listening for client requests on 127.0.0.1:2379
May 15 11:28:11 k8s-master-23051101-0 etcd[1340]: recovered store from snapshot at index 8920979
May 15 11:28:11 k8s-master-23051101-0 etcd[1340]: recovering backend from snapshot error: database snapshot file path error: snap: snapshot file doesn't exist

sudo systemctl restart etcd

Job for etcd.service failed because the control process exited with error code. See "systemctl status etcd.service" and "journalctl -xe" for details.

hieuhc avatar May 18 '18 12:05 hieuhc

Could you please paste the output of ls -l /etc/kubernetes/certs/? Also make sure that /usr/bin/etcd exists. Can you paste the end of the journalctl logs? Looks like the one you sent above is incomplete.

CecileRobertMichon avatar May 21 '18 17:05 CecileRobertMichon

I wonder if https://github.com/Azure/acs-engine/issues/1806#issuecomment-384033456 is related

CecileRobertMichon avatar May 21 '18 17:05 CecileRobertMichon

Hi again. Yes /usr/bin/etcd exists. I attach complete journalctl logs here. Output of ls -l /etc/kubernetes/certs/:

-rw-r--r-- 1 root root 4080 May  9 14:12 apiserver.crt
-rw------- 1 root root 3243 May  9 14:12 apiserver.key
-rw-r--r-- 1 root root 1720 May  9 14:11 ca.crt
-rw------- 1 root root 3243 May  9 14:12 ca.key
-rw-r--r-- 1 root root 1749 May  9 14:11 client.crt
-rw------- 1 root root 3243 May  9 14:12 client.key
-rw-r--r-- 1 root root 1814 May  9 14:12 etcdclient.crt
-rw------- 1 root root 3243 May  9 14:12 etcdclient.key
-rw-r--r-- 1 root root 1814 May  9 14:12 etcdpeer0.crt
-rw------- 1 etcd etcd 3243 May  9 14:12 etcdpeer0.key
-rw-r--r-- 1 root root 1814 May  9 14:12 etcdserver.crt
-rw------- 1 etcd etcd 3247 May  9 14:12 etcdserver.key

hieuhc avatar May 24 '18 12:05 hieuhc

The certs look as expected.

Did the upgrade succeed? Can you cat /etc/systemd/system/etcd.service? Also cat /etc/default/etcd

CecileRobertMichon avatar May 29 '18 23:05 CecileRobertMichon

Yes it succeeded after a few tries. But then I couldn't query cluster kubectl after that, as described above. cat /etc/systemd/system/etcd.service

[Unit]
Description=etcd - highly-available key value store
Documentation=https://github.com/coreos/etcd
Documentation=man:etcd
After=network.target
Wants=network-online.target
[Service]
Environment=DAEMON_ARGS=
Environment=ETCD_NAME=%H
Environment=ETCD_DATA_DIR=
EnvironmentFile=-/etc/default/%p
Type=notify
User=etcd
PermissionsStartOnly=true
ExecStart=/usr/bin/etcd $DAEMON_ARGS
Restart=always
[Install]
WantedBy=multi-user.target

cat /etc/default/etcd

DAEMON_ARGS=--name k8s-master-23051101-0 --peer-client-cert-auth --peer-trusted-ca-file=/etc/kubernetes/certs/ca.crt --peer-cert-file=/etc/kubernetes/certs/etcdpeer0.crt --peer-key-file=/etc/kubernetes/certs/etcdpeer0.key --initial-advertise-peer-urls https://10.240.255.5:2380 --listen-peer-urls https://10.240.255.5:2380 --client-cert-auth --trusted-ca-file=/etc/kubernetes/certs/ca.crt --cert-file=/etc/kubernetes/certs/etcdserver.crt --key-file=/etc/kubernetes/certs/etcdserver.key --advertise-client-urls https://10.240.255.5:2379 --listen-client-urls https://10.240.255.5:2379,https://127.0.0.1:2379 --initial-cluster-token k8s-etcd-cluster --initial-cluster k8s-master-23051101-0=https://10.240.255.5:2380 --data-dir /var/lib/etcddisk --initial-cluster-state new

hieuhc avatar May 30 '18 10:05 hieuhc

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. Note that acs-engine is deprecated--see https://github.com/Azure/aks-engine instead.

stale[bot] avatar Mar 09 '19 11:03 stale[bot]