Skip to content

Commit

Permalink
Fix/deployment command (#35)
Browse files Browse the repository at this point in the history
* Refactor: removed unnecessary comments and changed code for highlighting

* Fix: Fixed the deployment command and added some highlighting
  • Loading branch information
JTaeuber authored May 17, 2024
1 parent 5508b19 commit 8fdde83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ Python Kubernetes Downscaler

This is a fork of [hjacobs/kube-downscaler](https://codeberg.org/hjacobs/kube-downscaler) which is no longer maintained.

<!-- [![Travis CI Build Status](https://travis-ci.org/hjacobs/kube-downscaler.svg?branch=master)](https://travis-ci.org/hjacobs/kube-downscaler) -->
<!-- [![Code Coverage](https://coveralls.io/repos/github/hjacobs/kube-downscaler/badge.svg?branch=master;_=1)](https://coveralls.io/github/hjacobs/kube-downscaler?branch=master)
[![Docker pulls](https://img.shields.io/docker/pulls/hjacobs/kube-downscaler.svg)](https://hub.docker.com/r/hjacobs/kube-downscaler)
[![CalVer](https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg)](http://calver.org/) -->

Scale down / "pause" Kubernetes workload (`Deployments`, `StatefulSets`, and/or
`HorizontalPodAutoscalers` and `CronJobs` too !) during non-work hours.

Expand Down Expand Up @@ -134,15 +129,15 @@ The example configuration uses the `--dry-run` as a safety flag to
prevent downscaling \-\-- remove it to enable the downscaler, e.g. by
editing the deployment:

``` {.sourceCode .bash}
```bash
$ kubectl edit deploy py-kube-downscaler
```

The example deployment manifests come with a configured uptime
(`deploy/config.yaml` sets it to \"Mon-Fri 07:30-20:30 CET\"), you can
overwrite this per namespace or deployment, e.g.:

``` {.sourceCode .bash}
```bash
$ kubectl run nginx --image=nginx
$ kubectl annotate deploy nginx 'downscaler/uptime=Mon-Fri 09:00-17:00 America/Buenos_Aires'
```
Expand Down Expand Up @@ -181,7 +176,7 @@ with Deployments, consider the following:
To enable Downscaler on HPA with `--downtime-replicas=1`,
ensure to add the following annotations to Deployment and HPA.

``` {.sourceCode .bash}
```bash
$ kubectl annotate deploy nginx 'downscaler/exclude=true'
$ kubectl annotate hpa nginx 'downscaler/downtime-replicas=1'
$ kubectl annotate hpa nginx 'downscaler/uptime=Mon-Fri 09:00-17:00 America/Buenos_Aires'
Expand All @@ -198,13 +193,13 @@ Time definitions (e.g. `DEFAULT_UPTIME`) accept a comma separated list
of specifications, e.g. the following configuration would downscale all
deployments for non-work hours:

``` {.sourceCode .bash}
```bash
DEFAULT_UPTIME="Mon-Fri 07:30-20:30 Europe/Berlin"
```

To only downscale during the weekend and Friday after 20:00:

``` {.sourceCode .bash}
```bash
DEFAULT_DOWNTIME="Sat-Sun 00:00-24:00 CET,Fri-Fri 20:00-24:00 CET'
```
Expand Down Expand Up @@ -236,7 +231,7 @@ This definition will downscale your cluster between 19:00 and 20:00. If
you upscale your cluster manually, it won\'t be scaled down until next
day 19:00-20:00.
``` {.sourceCode .bash}
```bash
DOWNSCALE_PERIOD="Mon-Sun 19:00-20:00 Europe/Berlin"
```
Expand Down Expand Up @@ -351,7 +346,7 @@ Available command line options:
also be configured using Namespace annotations. **Where configured these
values supersede the other global default values**.
``` {.sourceCode .yaml}
```yaml
apiVersion: v1
kind: Namespace
metadata:
Expand Down
26 changes: 17 additions & 9 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This directory contains a tutorial to deploy py-kube-downscaler.

Please add below annotations based on timezone your deployment should run:

```
```yaml
metadata:
annotations:
downscaler/uptime: "Mon-Fri 07:00-19:00 US/Eastern"
Expand All @@ -41,11 +41,11 @@ Below are instructions to quickly install and configure py-kube-downscaler.
1. Make sure you're connected to the right cluster:
```
```bash
kubectl config current-context
```

2. Before deploying, make sure to update *values.yaml* in py-kube-downscaler chart depending on whether you want RBAC
2. Before deploying, make sure to update **values.yaml** in py-kube-downscaler chart depending on whether you want RBAC
roles deployed or not:

```yaml
Expand All @@ -57,15 +57,23 @@ Note: In case RBAC is enabled, a new service account will be created for py-kube
otherwise the 'default' one will be used.
3. Deploy py-kube-downscaler:
You can add our chart repository and deploy it by running:
```bash
helm repo add caas-team https://caas-team.github.io/helm-charts/

helm install py-kube-downscaler caas-team/py-kube-downscaler -n py-kube-downscaler
```
cd chart
helm install . --namespace py-kube-downscaler --name py-kube-downscaler

**OR**

You can alternatively clone this repository, change the current directory to the py-kube-downscaler repository and run:
```bash
helm install py-kube-downscaler ./chart -n py-kube-downscaler
```

4. Check the deployed release status:

```
```bash
helm list -n py-kube-downscaler
```

Expand All @@ -77,7 +85,7 @@ py-kube-downscaler 1 Tue Sep 25 02:07:58 2018 DEPLOYED py-kube-downsc

5. Check whether py-kube-downscaler pod is up and running:

```
```bash
kubectl get pods -n py-kube-downscaler
```

Expand All @@ -86,9 +94,9 @@ NAME READY STATUS RES
py-kube-downscaler-py-kube-downscaler-7f58c6b5b7-rnglz 1/1 Running 0 6m
```

6. Check the Kubernetes event logs, to make sure of successful deployment of py-kube-downscaler:
6. Check the Kubernetes event logs, to make sure the deployment of the py-kube-downscaler was successful:

```
```bash
kubectl get events -w
```

Expand Down

0 comments on commit 8fdde83

Please sign in to comment.