Set number of ReplicaSets to keep for k8s Deployment

By default, the Deployment in Kubernetes retains 10 ReplicaSets [1]. This number can be configured by setting the .spec.revisionHistoryLimit to a desired number. The following is an example on how to retain just 3 old ReplicaSets in my ‘’n8n’’ Deployment. ➜ k get replicasets -n n8n NAME DESIRED CURRENT READY AGE n8n-57c89d6b7d 0 0 0 91d n8n-5f9fb9c459 0 0 0 80d n8n-666b9476f 0 0 0 80d n8n-66cd6bd8c6 1 1 1 74d n8n-6888cc89bd 0 0 0 91d n8n-7466c456f8 0 0 0 91d n8n-74dfd6cb8c 0 0 0 80d n8n-f8f8f6d7b 0 0 0 237d Let set .spec.revisionHistoryLimit to 3: ...

October 5, 2025 · 1 min · 211 words · kenno

Setting Retention for Kube Prometheus Stack

When deploying the prometheus-community/kube-prometheus-stack in a k8s cluster, the default retention for Prometheus scrapped data is 10d at the time of this writing or Helm chart kube-prometheus-stack-69.4.1. As a result, the longhorn storage is filled up fast, and caused the Prometheus to crash. So I’d decided to change the retention period to 3 days, and also set retention size to 4GB. To do this, update the values file for the Helm chart with the following values: ...

February 25, 2025 · 1 min · 158 words · kenno

Deploy metrics-server in Kubernetes using Helm

This is a short note on how to install metrics-server using Helm on my k8s cluster. $ kubectl version Client Version: v1.29.3 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.3 $ helm version --short v3.14.4+g81c902a Before we can install the chart, we will need to add the metrics-server repo to Helm. $ helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/ Update the repo: $ helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "metrics-server" chart repository Update Complete. ⎈Happy Helming!⎈ I also need to make a small customization to the chart’s default value since my k8s cluster uses self-signed certificates. ...

April 24, 2024 · 2 min · 262 words · kenno

Transform SSL cert to inline format

We all know that the content of SSL CRT and KEY is a long string of characters broken by new line characters. If we want to use those SSL .crt and .key files with Kubernetes as a TLS secret, they required to be encoded as base64 and be in one-line. How to do this? Well, there are at least two ways. The first one is my favorite: $ base64 -w0 drone.example.com.crt LS0tLS1CRUdJTiBDRVJUSUXXX0FURS0tLS0tCk11SOQrekNDQXVPZ0F3SUJBZ0lVZW5BejFjb0ptakd4Q1dGVHRhOWVzeUM2WHZRd0RRWUpLb1pJaHZjTkFRRUwKQlFBd2dZUXhDekFKQmdOVkJBWVRBa0ZWTVJnd0ZnWURWUVFJREE5T1pYY2dVMjkxZEdnZ1YyRnNaWE14RHpBTgpCZ05WQkFjTUJsTjVaRzVsZVRFUk1BOEdBMVVFQ2d3SVUyRnV0eUJKYm1NeEV6QVJCZ05WQkFNTUNsTmhibmtnClUyVjJaVzR4SWpBZ0Jna3Foa2lHOXcwQkNRRVdFMjV2Y21Wd2JIbEFjMkZ1TjJsdVl5NWpiMjB3SGhjTk1qTXcKTmpFNE1ETTFOVFV4V2hjTk1qVXdPVEl3TURNMU5UVXhXakNCalRFTE1Ba0dBMVVFQmhNQ1FWVXhHREFXQmdOVgpCQWdNRDA1bGR5QlRiM1Yw ... w0 : disable line wrapping Another way is to use the good old tr command: ...

February 27, 2024 · 1 min · 125 words · kenno