Skip to main content

Scale down and restore Kubernetes deployments and statefulsets

Project description

kubedownscaler

Scales down Kubernetes Deployments and StatefulSets to 0 replicas, keeps note of the number of replicas in annotations, and scales everything back up to the original number of replicas.

Can operate on a single namespace, or the entire cluster. Can operate only on Deployments and StatefulSets that use a specific StorageClass

Ideal for performing a controlled shutdown, maintenance, etc.

Uses whatever context your local kubectl has.

Install

pip install kubedownscaler

Use

Either -d|--down or -u|--up must be specified.

usage: kubectl downscale [-h] (-d | -u) [--dry-run] [-n NAMESPACE] [--deployments | --no-deployments]
               [--statefulsets | --no-statefulsets] [--storageclass STORAGECLASS]

options:
  -h, --help            show this help message and exit
  -d, --down            scale down cluster resources
  -u, --up              scale up to restore state
  --dry-run             don't actually scale anything
  -n NAMESPACE, --namespace NAMESPACE
                        namespace to operate on
  --deployments, --no-deployments
                        scale Deployments (default: True)
  --statefulsets, --no-statefulsets
                        scale StatefulSets (default: True)
  --storageclass STORAGECLASS
                        only scale Deployments and StatefulSets that are consuming a specific StorageClass

Build

poetry install
poetry build
poetry publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubedownscaler-0.3.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

kubedownscaler-0.3.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file kubedownscaler-0.3.0.tar.gz.

File metadata

  • Download URL: kubedownscaler-0.3.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure

File hashes

Hashes for kubedownscaler-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fd2b083e887d39dfccab4b0fd16f28870854836922f5ed5023b034cc34ba3691
MD5 53f444f1e0aeb2e5ef5c4424c82f8214
BLAKE2b-256 3192bf933e826d061fa42858689770fe5c666955d2d3b53fe039709460d9ad1b

See more details on using hashes here.

File details

Details for the file kubedownscaler-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: kubedownscaler-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure

File hashes

Hashes for kubedownscaler-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5ef35a8029e81df265141f2f7a10c6fe4b60b778959efcc89d2b3b9a1d4834d
MD5 247b9554de9ed8a5e6ade2859cee48a1
BLAKE2b-256 db68bdd2f1a2c84c9f4c4884f4e307db65318e0cfedd29de3399da40b69d883b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page