SUSE Support

Here When You Need Us

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
    • Here we set the Character set to latin1 and collation to latin1_swedish_ci, as the original DB
    • we also chose the same name, as it is a new instance
  2. Restore the dump, you may use mysql db_name < backup-file.sql
  3. on the first node start k3s with:
    • curl -sfL https://get.k3s.io | sh -s - server --token <SERVER-TOKEN> --datastore-endpoint="mysql://<USERNAME>:<PASSWORD>@tcp(<INSTANCE-NAME>.mysql.database.azure.com:3306)/<RESTORED-DB>?tls=true"
    • the token is retrieve from the failed cluster in /var/lib/rancher/k3s/server/token
  4. Remove the failed nodes running:
    • k3s kubectl get nodes
    • k3s kubectl delete nodes <FAILED-NODE>
  5. 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.

  • Document ID:000020803
  • Creation Date: 07-Oct-2022
  • Modified Date:05-Jul-2024
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.