Skip to content

Instantly share code, notes, and snippets.

View initcron's full-sized avatar

Gourav Shah initcron

View GitHub Profile
@initcron
initcron / cluster.yaml
Created May 28, 2024 07:48
EKS Cluster Config
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-cluster-01
region: ap-southeast-1
vpc:
id: "vpc-aaaa"
subnets:
@initcron
initcron / cluster-autoscaler-autodiscover.yaml
Created May 23, 2024 10:34
Kubernetes Cluster Autoscaler for AWS EKS
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-addon: cluster-autoscaler.addons.k8s.io
k8s-app: cluster-autoscaler
name: cluster-autoscaler
namespace: kube-system
---

Scenario

Imagine we have a parent chart and a child chart. Each has a configuration value named replicaCount, which specifies the number of replicas for a deployment. We want to be able to override this value for different environments using separate files.

Directory Structure

parent/
  - charts/
    - child/
@initcron
initcron / vote-deploy.yaml
Created May 10, 2024 05:11
vote deployment with resources and strategy defined
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: vote
name: vote
annotations:
kubernetes.io/change-cause: "updated image to v2"
spec:
@initcron
initcron / kind-nginx-ingress-all.yaml
Last active May 9, 2024 09:39
Nginx Ingress Setup for KIND
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
name: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
@initcron
initcron / redis-sts.yaml
Created May 9, 2024 07:28
Redis Statefulset with PVC Templaet and 3 Replicas
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
labels:
app: redis
spec:
selector:
matchLabels:
role: master
@initcron
initcron / vote-ing.yaml
Last active May 8, 2024 05:11
Ingress Rule for Vote App for Traefik
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vote
namespace: instavote
spec:
ingressClassName: nginx
rules:
- host: vote.example.com
@initcron
initcron / user-data-k8s-v1.28.sh
Created March 12, 2024 11:25
Kubernetes Installation v1.28 User Data
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y git wget net-tools
# Prereqs
modprobe overlay
@initcron
initcron / vote-hpa.yaml
Last active May 5, 2024 05:17
HPA v2 Spec for Vote App
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: vote
spec:
minReplicas: 2
maxReplicas: 10
metrics:
- type: ContainerResource
containerResource:
@initcron
initcron / kind-install-metrics-server.md
Created January 23, 2024 05:38
Install Metrics Server on KIND Cluster