Skip to content

Restore k3s from MySQL dump

This document (000020803) is provided subject to the disclaimer at the end of this document.

Environment

k3s with an external database MySQL (this has been tested using Azure MySQL)

Situation

MySQL DB dump is available, and the cluster token from /var/lib/rancher/k3s/server/token

Resolution

  1. In the new MySQL instance create a database
  2. Here we set the Character set to latin1 and collation to latin1_swedish_ci, as the original DB
  3. we also chose the same name, as it is a new instance
  4. Restore the dump, you may use mysql db_name < backup-file.sql
  5. on the first node start k3s with:
  6. curl -sfL https://get.k3s.io | sh -s - server --token --datastore-endpoint="mysql://:@tcp(.mysql.database.azure.com:3306)/?tls=true"
  7. the token is retrieve from the failed cluster in /var/lib/rancher/k3s/server/token
  8. Remove the failed nodes running:
  9. k3s kubectl get nodes
  10. k3s kubectl delete nodes
  11. Join any additional node using the instructions from k3s documentation

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.