-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] about the HA-cluster #2329
Comments
The kubernetes API server needs a datastore to store its state. In MicroK8s by default this datastore is dqlite [1]. Three nodes in an dqlite HA cluster play the role of the voter. The voters maintain a copy of the database and they elect a leader. The leader is there to ensure everything written on the database is first replicated to the majority of the voters. This replication is part of the Raft [3] consensus protocol. To your questions:
You do not need to sync anything. Data are replicated across the nodes as part of the consensus protocol.
Every time something is written on the database it is first replicated across the voters. There is no periodic syncing and thus there is no frequency to control
The cost of replicating the database has to do with the workload it serves. There might be Kubernetes workloads that store lots of data on the API server is the form of CRD/resources. For every time a resource gets created/updated/deleted a respective operation needs to be replicated on the majority of the voters. May I ask, how do you plan to use MicroK8s? Are you under hardware constraints or you need to comply to certain specifications? [1] https://github.com/canonical/dqlite |
@ktsakalozos thanks for your response. actually I just use microk8s as a single node. but I encouter the dqlite-stored data corrupted, which will lead to a failure start and it is not able to recover. And I find a method for ha-cluster metioned in https://discuss.kubernetes.io/t/recovery-of-ha-microk8s-clusters/12931, so that i want to backup the data and use it to recover the microk8s, this has been verified. So in such situation, I just want to confirm what is stored and the frequency, so I can check when and how often is the best answer for the backup operation. |
Yes every time something if written in the database the data are persisted on the disk and synced across nodes.
The data written on disk are the k8s resources. Other cluster configuration you may want to backup are |
Hi @sunhubs, could you give us some more details on the data corruption? Do you get a useful error message? Can you list the contents of the database folder Thanks |
@ktsakalozos from my experience, the two /var/snap/microk8s/current/args and /var/snap/microk8s/current/certs with service arguments are not the problem, i can recover the microk8s by just replace the /var/snap/microk8s/current/var/kubenetes/backend. |
@MathieuBordere sorry for that i do not keep the clean corrupt data now, but i can replay my fault recover steps and describe the errors: |
thanks @MathieuBordere. Hopes it will be fixed in the future. |
I want to learn more details about the HA-cluster.
As I know, microk8s will sync the cluster information into the folder /var/snap/microk8s/current/var/kubenetes/backend, so I want to know:
1, the content of the data, I want to check whether it is needed to do frequent sync.
2, the default frequency and how to control it.
3, the cost time for every sync.
It is appreciate that you can provide some document or code snippnet for checking.
The text was updated successfully, but these errors were encountered: