schedule-pod-restart

by Codit

Helm chartv0.1.0

A Helm chart for automatically restarting pods with labels based on a cron schedule.

About this chart

Schedule Pod Restart

Automatically restarting pods with labels based on a cron schedule.

TL;DR

helm repo add coditeu https://coditeu.github.io/charts
helm repo update
helm install coditeu/cronjob-pod-restart

Introduction

Installing the Chart

To install the chart with the release name schedule-pod-restart:

$ helm install schedule-pod-restart coditeu/schedule-pod-restart --set cronjob.schedule="0 1 * * *" --set cronjob.podLabels="app=example"

Uninstalling the Chart

To uninstall the schedule-pod-restart deployment:

helm uninstall schedule-pod-restart

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the chart and their default values.

ParameterDescriptionDefault
nameOverrideName of the cronjob that will be createdChart Name schedule-pod-restart
serviceAccount.nameName of the service account to useoperations-pod-restart
serviceAccount.annotationsAnnotations for the service accountNone
role.nameName of the role to createmanage-pods-role
bindings.role.nameName of the role bindingmanage-pods-role-binding
cronjob.scheduleA cronjob expression that defines the schedule when the job should run. Learn more about the format in the official documentation.0 0 * * *
cronjob.podLabelsOne or more labels on the pods that need to be restarted. Use format key1=value1,key2=value2None
image.tagnameTag of container image that contains kubectlVersion of the Kubernetes cluster where the chart will be deployed

Deploy schedule-pod-restart with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has schedule-pod-restart 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 chartschedule-pod-restart is pinned at v0.1.0 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