Skip to content

Helps you periodically restart your k8s deployments!

Notifications You must be signed in to change notification settings

bahybintang/kube-restart

Repository files navigation

kube-restart

Helps you periodically restart your k8s deployments!

kubernetes go-version


Project Summary

This project helps to manage periodically restart deployment job for Kubernetes. It all centralized using one config or via annotations so you don't have to configure cronjob for every deployments manually. This project can work with either deployment or statefulsets.

Kube Restart Config

You can either apply the config using config file or via annotations on the deployments or statefulsets.

Via Config File

The config file is pretty simple consisting the list of deployments and statefulsets.

deployments:
- name: demo-deployment
  namespace: default
  schedule: "* * * * *"
- name: ingress-nginx-controller
  namespace: ingress-nginx
  schedule: "* * * * *"

statefulsets:
- name: demo-statefulsets-redis-replicas
  namespace: default
  schedule: "*/5 * * * *"

Via Kubernetes Annotations

You can add kube.restart/schedule annotation to the deployments or statefulsets to configure the restart schedule.

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kube.restart/schedule: '1 * * * *'
  name: demo-deployment
  namespace: default
...

Build, Run, and Deploy

How to Build

make build

How to Run Outside Cluster

make build
CONFIG_PATH=<CONFIG_PATH> ./service  --kubeconfig=<KUBECONFIG_PATH>

Install in Cluster

helm repo add kube-restart https://bahybintang.github.io/kube-restart
helm install kube-restart kube-restart/kube-restart

You can specify config in the Helm values, see this example.

About

Helps you periodically restart your k8s deployments!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published