:wave: Hi everyone! I'm looking for help with man...
# general
s
๐Ÿ‘‹ Hi everyone! I'm looking for help with managing StatefulSets using KubeGreen in Kubernetes. ๐Ÿ”น Specifically, how can I stop and start StatefulSets using KubeGreen? If anyone has done this before, could you please share a sample configuration or code snippet?
p
Hi @Sanket Arali, maybe you can try something along these lines: kube-green/testdata/working-hours.yml at main ยท kube-green/kube-green Only replace
Deployment
with
Statefulset
. I think that the generic way of patching resources introduced in latest versions allows to suspend Statefulset, following above example ๐Ÿ™‚
So, something like this?
Copy code
apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
  name: working-hours
spec:
  weekdays: "1-5"
  sleepAt: "20:00"
  wakeUpAt: "08:00"
  timeZone: "Europe/Rome"
  patches:
    - target:
        group: apps
        kind: StatefulSet
        # labelSelector: "env=dev"
      patch: |-
        - path: /spec/replicas
          op: replace
          value: 0
s
Thank you ๐Ÿ˜Š
p
Did this work? I'm currently using KEDA for scaling down dev workloads at night. It works well, although I'm curious if Kubegreen offers more features / better UX?
p
I've used Kube-green in the past, while at the time it didn't have the patch capability and so we had to use some trick with Statefulsets etc. etc. But it was well worth it, easy peasy nightly and on-weekend nodes shutdowns and automatic restarts at the end of sleep. We were pretty happy with it ๐Ÿ™‚
It's a simple K8s operator that, imho, does one thing and does it extremely well
p
awesome, I'll take a closer look. Thanks for the insight!