Skip to content

Instantly share code, notes, and snippets.

View initcron's full-sized avatar

Gourav Shah initcron

View GitHub Profile
@initcron
initcron / vote-ds.yaml
Created May 13, 2025 11:37
Create `demo` namespace and apply this code
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: vote
labels:
role: vote
namespace: demo
spec:
minReadySeconds: 20
selector:

Create and switch to instavote namespace

kubectl create namespace instavote
kubectl config set-context --current --namespace=instavote

switch to project directory

cd k8s-code/projects/instavote/dev
{
"title": "ML Model API - Full Observability Dashboard",
"timezone": "browser",
"refresh": "10s",
"schemaVersion": 30,
"version": 1,
"panels": [
{
"type": "timeseries",
"title": "Request Rate (Total per Endpoint)",
@initcron
initcron / fastapi_prom_grafana_dashboard.json
Created May 12, 2025 08:46
Import this as Grafana dashboard
{
"title": "FastAPI Prometheus Metrics Dashboard",
"timezone": "browser",
"refresh": "10s",
"schemaVersion": 30,
"version": 1,
"panels": [
{
"type": "timeseries",
"title": "Request Rate (Total)",
apiVersion: v1
kind: Service
metadata:
name: {{ include "vote.fullname" . }}
labels:
{{- include "vote.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}

Set up Nginx Ingress Controller for Traffic Routing

Install helm to setup Nginx Ingress Controller. To install helm version 3 on Linux or MacOS, you can follow following instructions.

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

You could further refer to Official HELM Install Instructions for alternative options.

@initcron
initcron / vote-ing.yaml
Last active April 24, 2025 09:12
Vote Ingress with Nginx
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vote
namespace: instavote
spec:
ingressClassName: nginx
rules:
- host: vote.example.com
@initcron
initcron / vote-deploy.yaml
Created April 14, 2025 02:57
Vote Deployment with RollingUpdate Strategy
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote
labels:
role: vote
spec:
minReadySeconds: 20
replicas: 4
strategy:
@initcron
initcron / mlops-pipeline.yaml
Last active May 13, 2025 10:04
MLOps Pipeline for House Price Predictor
# .github/workflows/mlops-pipeline.yml
name: MLOps Pipeline
on:
workflow_dispatch:
inputs:
run_all:
description: 'Run all jobs'
required: false
default: 'true'
@initcron
initcron / vote-deploy-cm.yaml
Created April 2, 2025 13:59
Working Deployment Spec with ConfigMaps
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote
labels:
role: vote
annotations:
kubernetes.io/change-cause: "image updated to v4"
spec:
replicas: 4