Kubernetes as failover

Hi all,

I am a beginner, so I already setup docker on ubuntu with 2 containers (cloud server&database).

I am planning to create/setting a failover, can I use kubernetes as the failover service?

thanks and have a good day!

Sorry, I’m not sure I follow. As backup in which sense?

Like have two independent setups (your current one and s new one with kubernetes)? I’m not sure I follow, sorry. Can you please elaborate?

If it’s that (let me know if it isn’t!), It’s totally independent of kubernetes. You can have the app running in a container in docker, in kubernetes, in a VM, it doesnt really matter as long as it runs your process.

The potential problem, usually, is the DB is state you need to maintain. But that is the same if using docker, kubernetes or chef. Nothing really changes, it is something to solve at different layer :frowning:

Hi Rata, thanks.

so currently I have vm, installed ubuntu. and I have installed docker inside with 2 containers. The first is owncloud, and second is the database for owncloud. now its working fine, i can access/connect locally after I start the container.

so now, i want to implement the failover. lets say I will have 2 owncloud, 1 as master and 1 as backup. when the owncloud master down, then the backup will switch so the server will not completely down.

and i am a beginner, so yeah i am not sure about this thing. that is why need help and guidance :))


You have that setup in docker and want to move it to kubernetes?

You have at least the two parts you described: the app server and the DB. Not sure if files are written locally to the disk, in that case you have something else to consider.

But the main thing is how you can solve that in the application, no matter how that process is running (containers, kubernetes or directly in the host).

One simple scenario, if the owncloud app doesn’t store files locally, is to create a setup where there are 2 owncloud app container and one DB. The traffic is split into both containers and if one dies, the other handles all the traffic transparently. In this case, however, if the DB dies you won’t have it replicated (unless you try to replicate the DB too, but I’d leave that for a later stage :))

Also, it may make sense to see which options owncloud provides for a hot/standby mode. As this is totally up to the application to handle, they may have docs on this.

However, I’d start moving those containers to kubernetes as a first step. Then, going for 2 replicas of the owncloud app (if it doesn’t store files locally should be trivial) and then see how far you want to get (and research a little bit about owncloud replication docs, etc.)

Does it make sense?


Hi Rata! thanks for the reply, yeah what you explained make sense. I will try this, do you have some references regarding this? it will really help me. Thanks!

I think the getting started docs in kubernetes.io should do it.

The docs had some refactors and improvements, so don’t remember the name, but read the general things making sure to read about pods, deployments and services. I think that is what you need for the owncloud deployment.

For the DB it may be more tricky, but if you can host the DB externally first and connect from the pods, that would be easier. However, it really depends on how you are running kubernetes (as networking is complicated), and maybe is easier to move the DB to kubernetes too (be aware of persistent storage).

Let us know how the experiment goes! :slight_smile: