k8s-deployment-restarter

by kmatsebora

Helm chartv1.0.4App 1.0.0MITVerified publisher

Restarts k8s deployment resource by schedule

About this chart

k8s deployment restarter

Helm chart for restarting kubernetes deployment resource by schedule.

Supports two strategies:

  • restart - using kubectl command kubectl rollout restart deployment/daemonset, supports deployments and daemonsets.
  • scaleDownUp - scales down to zero and up to particular number of replicas, could be useful when destroying pod also requires release of some resources (for instance mounted volumes), supports deployments only.

Configuration

restart: 
  - name: deployments-to-restart # name of batch
    schedule: "7 */3 * * *" # cron schedule definition
    deployments: # list of deployments needs to be restarted
    - nginx-ingress
    - oauth2-proxy
    daemonSets: [] # list of daemonSets needs to be restarted

scaleDownUp: 
  - name: deployments-to-scaledownup # name of batch
    schedule: "7 */3 * * *" # cron schedule definition
    sleepPeriodInSeconds: 30 # sleep period in seconds between scaling down and scaling up
    deployments: # list of deployments needs to be restarted
    - name: nginx-ingress # name of deployment resource
      replicas: 1 # replicas number
    - name: oauth2-proxy
      replicas: 2
    

Usage

Add helm repository first:

helm repo add kostiantyn-matsebora https://kostiantyn-matsebora.github.io/helm-charts/

Install/upgrade helm chart using your custom values:

helm upgrade oauth2-proxy kostiantyn-matsebora/k8-deployment-restarter --install --values ./custom-values.yaml

Contributing

If you experience any issues, have a question or a suggestion, or if you wish to contribute, feel free to open an issue or start a discussion.

License

Deploy k8s-deployment-restarter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has k8s-deployment-restarter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartk8s-deployment-restarter is pinned at v1.0.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply