vault fails to start when MySQL backend down
Bug #1818973 reported by
James Page
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vault-charm |
Triaged
|
High
|
Unassigned |
Bug Description
Whilst performing some full outage reboot testing, I noticed that vault daemons sometimes fail to start if the backend MySQL database is not contactable.
We should probably tune the systemd unit to deal with this as vault itself does not seem to be able to configure a retries or suchlike.
Changed in vault-charm: | |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: seg |
tags: | added: cold-start |
Changed in vault-charm: | |
status: | Confirmed → Triaged |
importance: | Medium → High |
To post a comment you must log in.
This can be reproduced with cs:vault-35 :
1. Deploy, initialize and unseal a vault:
juju deploy cs:vault-35 $(juju run --unit vault/0 'unit-get private- address' ):8200" QznosX+ kmCnFRqOiNhq4Xq 5GZtR9y dJ+yEsUP1q6mK4I 5tK2GRH+ RrRQsv s.sNyy3wrtrNoVU Dj0NCWmMyUd vNrCZl8c9qUXueQ hgqrr0kQP
juju deploy mysql
juju relate vault mysql
export VAULT_ADDR="http://
vault operator init -key-shares=5 -key-threshold=2
vault operator unseal A1I4gVtqqFoDBEo
vault operator unseal K/ASAolWEA1ngDi
export VAULT_TOKEN=
vault token create -ttl=10m
juju run-action --wait vault/0 authorize-charm token=s.
2. Pause the vault and stop mysql:
juju run-action --wait vault/0 pause # -> blocked: Vault service not running
juju run --unit mysql/0 -- systemctl stop mysql
3. Resume the vault:
juju run-action --wait vault/0 resume # -> still blocked: Vault service not running
Logs show:
2020-03-09 14:34:17 ERROR juju-log Traceback (most recent call last): juju/agents/ unit-vault- 0/.venv/ lib/python3. 6/site- packages/ urllib3/ connection. py", line 157, in _new_conn _dns_host, self.port), self.timeout, **extra_kw juju/agents/ unit-vault- 0/.venv/ lib/python3. 6/site- packages/ urllib3/ util/connection .py", line 84, in create_connection juju/agents/ unit-vault- 0/.venv/ lib/python3. 6/site- packages/ urllib3/ util/connection .py", line 74, in create_connection connect( sa) edError: [Errno 111] Connection refused
File "/var/lib/
(self.
File "/var/lib/
raise err
File "/var/lib/
sock.
ConnectionRefus
4. Resurrect mysql:
juju run --unit mysql/0 -- systemctl start mysql
Expected: the vault service resurrects at some point
Actual: the vault service remains stopped until the operator performs a 'resume' action again.