k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.56k stars 233 forks source link

How does kine with mysql handle conflicting writes from two API servers concurrently #138

Open friggitello6 opened 1 year ago

friggitello6 commented 1 year ago

Using mysql as external storage, how does kine handle conflicting writes from two different API servers concurrently?

brandond commented 1 year ago

It handles it quite well!

https://github.com/k3s-io/kine/issues/106#issuecomment-931020453

friggitello6 commented 1 year ago

It handles it quite well!

#106 (comment)

great, so we rely on DB MVCC. This means if I write a controller and try to update a resource, the controller is responsible to handle the "resource already modified error" and potentially reload and retry, right? If that's the case, do we need to do the same for controller running on K8s where the write always goes through the etcd leader?

On the similar topic, is there any container app that can run on k8s, but not K3s? In other words, can someone on purposely write a container app that doesn't work on k3s, but works on k8s?

brandond commented 1 year ago

Kine implements all the required bits for Kubernetes to function properly, including guarantees around consistency of sequential writes. Dealing with retries is part of writing any Kubernetes controller.

K3s is a Kubernetes distro. It is built from the same upstream code as all the other distros and passes all the standard conformance tests. It is not anything other than Kubernetes and does not behave differently, regardless of what datastore you use.