chaoskube icon indicating copy to clipboard operation
chaoskube copied to clipboard

exclude apps, with only 1 replica

Open robert-stevenson opened this issue 7 years ago • 2 comments

I'd like the ability to exclude apps with only 1 replica; any ideas? Would require a change I presume...

robert-stevenson avatar Apr 11 '18 18:04 robert-stevenson

That would be a bit more work as chaoskube currently works solely on the Pod list.

One would have to use the ownerReferences to find its ReplicaSet and from there the current number of siblings.

Another but more hackier way would be to take the labels of the potential target Pod and make sure there's at least one other Pod matching the same labels before killing it. (Other Pods with the same labels are likely members of the same Deployment I would assume.)

An alternative would be to continue work on respecting PodDisruptionBudgets (PDBs)(https://github.com/linki/chaoskube/issues/13) in which case you could "protect" your single Pod. However, that would also effect all other components working on PDBs such as controlled cluster updates which might not like that. (PDBs for single replica Deployments aren't really good practice.)

linki avatar Apr 18 '18 13:04 linki

I think this makes a lot of sense in order to start using chaoskube without unnecessary interruptions.

There are applications that aren't high-available and if their single replica dies they are just gone for a moment. If you're fine with that and still want to use chaoskube on all of your other stuff, there should be an option to do just that.

Let's go with:

One would have to use the ownerReferences to find its ReplicaSet and from there the current number of siblings.

Furthermore, anything that isn't reconciled by a controller (e.g. kubectl run -i -t busybox --image=busybox --restart=Never) should also be excluded in this mode.

/cc @robert-stevenson

linki avatar Jun 02 '18 17:06 linki