11. Maintenance
This chapter shows how to back up and restore kudurru, how to upgrade it, how to recover a lost password and how to monitor it.
Before you start: You can run commands on the host of the node. For some tasks you have the role Admin.
What to back up
| Item | Where | Back up with |
|---|---|---|
| The data volume (objects, users, tokens, audit log, query log, lists) | /var/lib/kudurru | A copy of the volume |
| The encryption key | secrets/encryption_key | A copy in a safe place |
kudurru.yaml and objects.d/ | /etc/kudurru | A copy of the files |
| The objects only | The API | kudurru backup |
The command kudurru backup saves zones, record sets, lists, client groups
and policies. It does not save users, tokens, the audit log or the query
log. Use the volume copy for these.
Back up
Copy the volume (Docker)
The commands use the container and the volume of Chapter 2. For Docker
Compose, use docker compose stop kudurru and docker compose start kudurru. The volume name then has the name of the project as a prefix.
Stop the container so that the files are consistent:
docker stop kudurruCopy the volume to a file:
docker run --rm -v kudurru-data:/data -v "$PWD:/backup" busybox \ tar -czf /backup/kudurru-data.tgz -C /data .Start the container:
docker start kudurru
CAUTION: While the container does not run, the network has no DNS. Do this at a time when this is acceptable, or use more than one node.
Save the objects
You can do this while kudurru runs.
kudurru backup --out objects.yaml
Add --safe to remove passwords and keys from the URLs of lists. Then you
can share the file. Before you restore a file that you saved with --safe,
put the secrets back.
To skip the objects that a file or an integration owns, add
--exclude-managed.
Download from the dashboard
The page Tools has the section Backup and export. It has links for
the objects as JSON files and for each zone as a BIND file. Use the command
kudurru backup for a file that you can restore.
Restore
Restore the whole volume
Stop and remove the container:
docker stop kudurruanddocker rm kudurru.Put the content of the backup into the volume:
docker run --rm -v kudurru-data:/data -v "$PWD:/backup" busybox \ tar -xzf /backup/kudurru-data.tgz -C /dataStart the container again with the command of Chapter 2. Use the same encryption key.
Restore the objects only
Start a node (Chapter 2).
Sign in with the command line (Chapter 10).
Run the command:
kudurru restore -f objects.yaml
The command shows the result for each object.
NOTE: Without a license key, kudurru restores no policy other than the
policy default. The other policies get the error license_required. Put
the key on the node before you restore (Chapter 13).
CAUTION: If the encryption key is not the same, kudurru cannot read the stored secrets.
Upgrade
kudurru stores a schema version in its data files. A new program converts older data when it starts. A program refuses to start with data that a newer program wrote. You cannot go back to an older version after a change of the schema. Make a backup first.
For a 0.1.0 to 0.2.0 upgrade, keep the complete stopped data volume, the matching encryption key, configuration and old executable or image. An object export does not include all credential, query-history and audit state. Rehearse restoration on a disposable copy before the upgrade window. Keep the backup protected as credentials.
Read the release notes. Check for changes that need an action.
Back up (see above).
Pull the new image. Replace
<version>with the new version:docker pull ghcr.io/robertherbaugh/kudurru:<version>Stop and remove the old container. The data stays in the volume:
docker stop kudurru && docker rm kudurruStart a new container with the command of Chapter 2. Use the new version in the image name.
Check that the node is ready:
docker exec kudurru kudurru health --readyOpen the dashboard. Open System > Diagnosis. Check that there are no new errors.
For Helm, Compose with more than one node, and packages, see the upgrade runbook. With more than one node, upgrade one node at a time. Wait until the node is ready before you go to the next.
Before you upgrade from version 0.1 to version 0.2, read the upgrade notes for 0.1.x. They give the order of the steps.
Roll back to 0.1.0
- Stop every process that uses the upgraded data. Keep a separate copy of that data if you need to investigate or recover later writes.
- Restore the complete pre-upgrade volume into an empty directory or volume. Do not extract it over the upgraded database files or combine their WAL files.
- Restore the matching pre-upgrade configuration and encryption key. Start the retained 0.1.0 executable or image against the restored volume.
- Check readiness, representative DNS answers, sign-in and API credentials, query history and the audit trail. Restart once and check again.
Writes made after the backup are absent after rollback. The old binary's refusal to open an upgraded database is expected; editing schema versions does not provide a rollback. Kubernetes IAM also needs its matching private identity state; follow the offline migration procedure.
Recover a lost admin password
You need access to the host. The command uses a local socket and no password.
Reset the password:
docker exec kudurru kudurru admin reset-password adminRead the new password in the output. kudurru shows it one time.
Sign in with the new password. The dashboard asks you to change it.
To set a password that you choose, add --password-stdin and give the
password on the standard input.
To make a token for a program when no user can sign in:
docker exec kudurru kudurru admin create-token --expires-in 1h
To list the local users:
docker exec kudurru kudurru admin list-users
NOTE: Only root, the user of the server, and a group that you set with
auth.adminSocket.group can use these commands. Keep this access limited.
Recover a lost authenticator
Use this procedure when the only administrator lost the authenticator (Chapter 9). If a different administrator can sign in, use the tab Identity of the dashboard. You need access to the host.
NOTE: A new password does not remove an authenticator.
Make a token on the host. The command prints it one time:
docker exec kudurru kudurru admin create-token --expires-in 1hConnect the command line with the token. Enter the token on the standard input:
kudurru login --server https://dns.example.net:8080 --token-stdinFind the
uidof the account in the list of users:kudurru api /iam/usersRemove the authenticator. Replace
<uid>with the value from step 3:kudurru api POST /iam/users/admin/totp/recover --data '{"uid":"<uid>"}'
kudurru removes the authenticator and signs out the browser sessions of the account. Sign in with the password only. Then set up a new authenticator.
Rotate the encryption key
Do not replace the encryption key without a plan. If you replace it without the old key, kudurru cannot read the stored secrets. Follow the key rotation runbook.
Monitor kudurru
| Tool | Use |
|---|---|
| Dashboard | The statistics and the status area |
| Diagnosis | The messages about the setup |
kudurru health --ready | Readiness of one node |
Port 8081 (/healthz/ready) | Readiness for load balancers. It needs no sign-in. |
Port 9153 (/metrics) | Metrics for Prometheus |
deploy/grafana/kudurru-overview.json | A Grafana dashboard that you can import |
deploy/prometheus/rules.yaml | Alert rules |
To get the metrics in Docker, publish the metrics port. The compose file in
deploy/compose/single has a comment that shows how.
Change the log level
The server log has the level info by default. For a problem, set it to
debug for a short time:
kudurru settings set log.level=debug
Set it back with kudurru settings set log.level-.
Read the log of the container with docker logs kudurru.
Remove data
| Task | How |
|---|---|
| Delete old query log rows | Query log > Purge… (Chapter 3) |
| Delete an object | The page of the object, or kudurru delete |
| Remove all data | Stop the node. Delete the data volume. |
CAUTION: You cannot undo the deletion of a data volume. Back up first.