etcd-defrag

by christianhuth

Helm chartv1.7.3App v3.7.4Verified publisher

A Helm chart for running a defragmentation CronJob for ETCD

About this chart

etcd-defrag

A Helm chart for running a defragmentation CronJob for ETCD

TL;DR;

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/etcd-defrag

Or install it from the OCI registry:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/etcd-defrag

Introduction

The process of defragmentation releases storage space blocked by ETCD fragmentation back to the file system.

Note that defragmentation to a live member blocks the system from reading and writing data while rebuilding its states.

This chart bootstraps a CronJob to perform periodically defragmentation for ETCD on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.19+

Installing the Chart

To install the chart with the release name my-release:

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/etcd-defrag

The chart is also published as an OCI artifact which can be installed like this:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/etcd-defrag

These commands deploy the CronJob on the Kubernetes cluster in the default configuration. The Values section lists the values that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall the my-release deployment:

helm uninstall my-release

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

Values

KeyTypeDefaultDescription
affinityobject{}Affinity settings for pod assignment
defrag.config.auth.enabledboolfalseuse username and password for authentication against etcd
defrag.config.auth.existingSecretstring""Name of existing secret to use for authentication credentials. Key needs to be called etcd-password.
defrag.config.auth.passwordstring""password for authentication
defrag.config.auth.userstring""username for authentication
defrag.config.clusterWidebooltrueRun defragment operations for all endpoints in the cluster associated with the default endpoint.
defrag.config.commandTimeoutstring""timeout for short running command (excluding dial timeout)
defrag.config.debugboolfalseenable client-side debug logging
defrag.config.dialTimeoutstring""dial timeout for client connections
defrag.config.endpointslist[]gRPC endpoints
defrag.config.insecureSkipTlsVerifyboolfalseskip server certificate verification
defrag.config.insecureTransportbooltruedisable transport security for client connections
defrag.config.pki.castring""certificate authority used for the etcd certificates
defrag.config.pki.certstring""identify secure client using this TLS certificate
defrag.config.pki.existingSecretstring""Name of existing secret with certificates. Keys needs to be called ca, cert and key.
defrag.config.pki.hostAccess.caFilePathstring"/etc/kubernetes/pki/etcd/ca.crt"file on host containing the certificate authority
defrag.config.pki.hostAccess.certFilePathstring"/etc/kubernetes/pki/etcd/server.crt"file on host containing the server certificate
defrag.config.pki.hostAccess.enabledboolfalseget certificates directly from host where the Pod is running
defrag.config.pki.hostAccess.keyFilePathstring"/etc/kubernetes/pki/etcd/server.key"file on host containing the server private key
defrag.config.pki.keystring""identify secure client using this TLS key
defrag.config.writeOutstring"table"set the output format: fields, json, protobuf, simple, table)
defrag.cronjob.concurrencyPolicystring"Forbid"Specifies how to treat concurrent executions of a Job. Valid values are: Allow, Forbid and Replace.
defrag.cronjob.failedJobsHistoryLimitstring"1"The number of failed finished jobs to retain.
defrag.cronjob.schedulestring"0 */1 * * *"The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
defrag.cronjob.startingDeadlineSecondsstring"30"Optional deadline in seconds for starting the job if it misses scheduled time for any reason. Missed jobs executions will be counted as failed ones.
defrag.cronjob.successfulJobsHistoryLimitstring"3"The number of successful finished jobs to retain.
defrag.cronjob.suspendboolfalseThis flag tells the controller to suspend subsequent executions, it does not apply to already started executions.
defrag.enabledbooltruecreate a CronJob for defragmentation
defrag.job.activeDeadlineSecondsstring""Specifies the duration in seconds relative to the startTime that the job may be continuously active before the system tries to terminate it.
defrag.job.backoffLimitstring""Specifies the number of retries before marking this job failed.
defrag.job.completionModestring""CompletionMode specifies how Pod completions are tracked. It can be: NonIndexed or Indexed.
defrag.job.completionsstring""Specifies the desired number of successfully finished pods the job should be run with.
defrag.job.parallelismstring""Specifies the maximum desired number of pods the job should run at any given time.
defrag.job.podFailurePolicystring""Specifies the policy of handling failed pods.
defrag.job.suspendboolfalseSuspend specifies whether the Job controller should create Pods or not.
defrag.job.ttlSecondsAfterFinishedstring""limits the lifetime of a Job that has finished execution
defrag.pod.restartPolicystring"OnFailure"Restart policy for all containers within the pod. One of Always, OnFailure, Never.
extraEnvlist[]additional environment variables to be added to the pods
extraVolumeMountslist[]additional volume mounts to be added to the pods
extraVolumeslist[]additional volumes to be added to the pods
fullnameOverridestring""String to fully override "etcd-defrag.fullname"
hostNetworkboolfalsespecify if the CronJob should run on the hostNetwork
image.pullPolicystring"Always"image pull policy
image.registrystring"quay.io"image registry
image.repositorystring"coreos/etcd"image repository
image.tagstring"v3.7.4"Overrides the image tag
imagePullSecretslist[]If defined, uses a Secret to pull an image from a private Docker registry or repository.
nameOverridestring""Provide a name in place of etcd-defrag
nodeSelectorobject{"node-role.kubernetes.io/control-plane":""}Node labels for pod assignment
podSecurityContextobject{}pod-level security context
resourcesobject{}Resource limits and requests for the controller pods.
securityContextobject{}container-level security context
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
tolerationslist[{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane"}]Toleration labels for pod assignment

Specify each parameter using the --set key=value[,key=value] argument to helm install.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

helm install my-release -f values.yaml christianhuth/etcd-defrag

Deploy etcd-defrag with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has etcd-defrag 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 chartetcd-defrag is pinned at v1.7.3 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