Skip to content

Instantly share code, notes, and snippets.

@zaffys
zaffys / k8s-using-talos-in-vms.md
Created May 7, 2025 17:41 — forked from cyrenity/k8s-using-talos-in-vms.md
Setup kubernetes cluster using Talos (Lab)

Setup Kubernetes cluster in minutes using Talos

1. Get talosctl

Download and install talosctl binary

wget https://github.com/talos-systems/talos/releases/download/v0.8.1/talosctl-linux-amd64
@zaffys
zaffys / k8s-pod-oom-prevent-02.md
Last active April 16, 2025 18:29
Prevent Pods from getting OOM

Architecture Design Decision: Proactive Memory-Based Graceful Shutdown for Kafka Streams Pods in OpenShift

Problem Statement

Pods running in an OpenShift Kubernetes environment process complex events using Kafka Streams and KTables, with state stores backed by RocksDB. Over time, these state stores consume increasing memory until the container exceeds its memory limit, crashes, and causes data loss. To mitigate this, we need a mechanism to detect impending memory exhaustion, trigger a graceful shutdown, and allow the pod to restart without data loss.

Key Requirements

  1. Proactive Memory Monitoring: Detect when memory usage approaches the container's limit.
  2. Graceful Shutdown: Safely terminate Kafka Streams operations to commit state and offsets.
  3. State Recovery: Ensure the pod resumes processing from the last committed state after restart.
  4. Automation: Minimize manual intervention and integrate with OpenShift/Kubernetes lifecycle management.
@zaffys
zaffys / get-deployment-res.sh
Last active February 9, 2025 01:44
Scripts to automate stuff
#!/bin/bash
# ------------------- Logging Function -------------------
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a logs/get-deployment-resources-$(date +"%Y%m%d%H%M%S").log
}
# Ensure required directories exist
mkdir -p logs data