Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

webdevops/kube-janitor

Repository files navigation

Kubernetes Janitor (kube-janitor)

license DockerHub Quay.io Artifact Hub

Kubernetes janitor which deletes resources by TTL annotations/labels and static rules written in Golang

By default the janitor uses the creation timestamp from every resource but can also use a custom timestamp by using a JMES path with timestampPath.

Configuration

see example.yaml for example configurations

Usage:
 kube-janitor [OPTIONS]
Application Options:
 --version Show version
 --version.template= Version go template, eg {{.Version}}
 --log.level=[trace|debug|info|warning|error] Log level (default: info) [$LOG_LEVEL]
 --log.format=[logfmt|json] Log format (default: logfmt) [$LOG_FORMAT]
 --log.source=[|short|file|full] Show source for every log message (useful for debugging and bug reports) [$LOG_SOURCE]
 --log.color=[|auto|yes|no] Enable color for logs [$LOG_COLOR]
 --log.time Show log time [$LOG_TIME]
 --interval= Janitor interval (time.duration) (default: 1h) [$JANITOR_INTERVAL]
 --config= Path to kube-janitor config file [$JANITOR_CONFIG]
 --dry-run Dry run (no delete) [$JANITOR_DRYRUN]
 --once Run once and exit [$JANITOR_ONCE]
 --kubeconfig= Kuberentes config path (should be empty if in-cluster) [$KUBECONFIG]
 --kube.itemsperpage= Defines how many items per page janitor should process (default: 100) [$KUBE_ITEMSPERPAGE]
 --server.bind= Server address (default: :8080) [$SERVER_BIND]
 --server.timeout.read= Server read timeout (default: 5s) [$SERVER_TIMEOUT_READ]
 --server.timeout.write= Server write timeout (default: 10s) [$SERVER_TIMEOUT_WRITE]
Help Options:
 -h, --help Show this help message

TTL tag

Supported absolute timestamps

  • 2006年01月02日 15:04:05 +07:00
  • 2006年01月02日 15:04:05 MST
  • 2006年01月02日 15:04:05
  • 02 Jan 06 15:04 MST (RFC822)
  • 02 Jan 06 15:04 -0700 (RFC822Z)
  • Monday, 02-Jan-06 15:04:05 MST (RFC850)
  • 2006年1月02日 15:04:05 MST (RFC1123)
  • 2006年1月02日 15:04:05 -0700 (RFC1123Z)
  • 2006年01月02日T15:04:05Z07:00 (RFC3339)
  • 2006年01月02日T15:04:05.999999999Z07:00 (RFC3339Nano)
  • 2006年01月02日

Supported relative timestamps (time.Duration and fortio.org/duration)

  • 1m (minute)
  • 1h (hour)
  • 1d (day)
  • 1d6h (1 day, 6 hours)
  • 1w (1 week)
  • 1w2d6h (1 week, 2 days, 6 hours)

Metrics

Metric Description
kube_janitor_resource_deleted_total Total number of deleted resources (by namespace, gvk, rule)
kube_janitor_resource_ttl_expiry_timestamp_seconds Expiry date (unix timestamp) for every resource which was detected matching the TTL expiry
kube_janitor_resource_rule_expiry_timestamp_seconds Expiry date (unix timestamp) for every resource which was detected matching the static expiry rules

About

Kubernetes janitor (automatic deletion of resoruces with a TTL)

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /