From 8fdde83c52460b5339cce9bcbdd3ad8d69e5046e Mon Sep 17 00:00:00 2001 From: Jan <157487559+JTaeuber@users.noreply.github.com> Date: Fri, 17 May 2024 09:37:08 +0200 Subject: [PATCH] Fix/deployment command (#35) * Refactor: removed unnecessary comments and changed code for highlighting * Fix: Fixed the deployment command and added some highlighting --- README.md | 19 +++++++------------ chart/README.md | 26 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1bb98a5..bed7aa3 100644 --- a/README.md +++ b/README.md @@ -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. - - - Scale down / "pause" Kubernetes workload (`Deployments`, `StatefulSets`, and/or `HorizontalPodAutoscalers` and `CronJobs` too !) during non-work hours. @@ -134,7 +129,7 @@ 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 ``` @@ -142,7 +137,7 @@ 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' ``` @@ -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' @@ -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' ``` @@ -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" ``` @@ -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: diff --git a/chart/README.md b/chart/README.md index accadf2..7600d86 100644 --- a/chart/README.md +++ b/chart/README.md @@ -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" @@ -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 @@ -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 ``` @@ -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 ``` @@ -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 ```