Skip to content

Instantly share code, notes, and snippets.

View initcron's full-sized avatar

Gourav Shah initcron

View GitHub Profile
@initcron
initcron / databases_on_kubernetes.md
Created October 29, 2025 07:30
Best Practices for Running Databases on Kubernetes

Following is a crisp, battle-tested playbook for running databases on Kubernetes—what to do, what to avoid, and how to keep them safe, fast, and recoverable.

Before you start

  • Default to managed DBs if possible (RDS/Aurora/Cloud SQL/AlloyDB/Atlas). Run on K8s only when you need: portability, custom extensions, tight sidecar/tooling, or cost control with commodity nodes.
  • Use an Operator, not raw manifests. Prefer mature operators (e.g., Crunchy/Percona for Postgres & MySQL, Vitess for MySQL sharding, PXC/MongoDB Enterprise/StackGres, RabbitMQ Operator for queues). Operators give sane HA, backups, upgrades, and day-2 ops.

Core architecture

  • StatefulSets + Headless Services for stable identities and volumes.
@initcron
initcron / airbnb_mcp-gemini.py
Created October 17, 2025 04:47
Agno Agent to search for AirBnB Listings
# airbnb_mcp.py
from textwrap import dedent
from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.mcp import MCPTools
from agno.tools.reasoning import ReasoningTools
from agno.os import AgentOS
@initcron
initcron / pre.md
Last active October 16, 2025 16:30

switch to instavote namespace

kubectl config set-context --current --namespace=instavote
helm uninstall -n dev instavote 
kubectl delete deploy vote redis db result worker  -n instavote 
kubectl delete svc vote redis db result -n instavote 
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vote
namespace: instavote
spec:
ingressClassName: nginx
rules:
- host: vote.example.com

Event Driven Auto Scaling with KEDA

Configure Prometheus

Install Prometheus with Grafana with helm

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

Create a namespace

kubectl create namespace instavote 
kubectl config set-context --current --namespace=instavote
git clone https://github.com/schoolofdevops/instavote-kustomize.git
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: vote

rag/build_index.py

# rag/build_index.py
import argparse, json
from pathlib import Path
from typing import Dict, Any, Iterable, Tuple, List

# ---------- common snippet renderers ----------

What’s happening

  • That log line:

    Overriding ... dispatch key: AutocastCPU ... new kernel: ... ipex-cpu ...
    INFO ... Automatically detected platform cpu.
    

means IPEX’s autocast kernels replaced the default ones. With --dtype=float16 on CPU, PyTorch/ipex either upcasts or hits slow/non-vectorized code paths and can “hang” at model load/compile.

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,