Skip to content

Instantly share code, notes, and snippets.

View grampelberg's full-sized avatar

Thomas Rampelberg grampelberg

View GitHub Profile
@grampelberg
grampelberg / iptables.bash
Created November 13, 2019 22:58
k8s diagnostic tools
# Get iptables dumps for *every* namespace currently on the host
# NOTE: k8s services go into the host network namespace so they're inherited by everyone
# pod ip addresses go into their own network namespace
lsns | grep net | awk '{ print $4 }' | xargs -IX nsenter -t X -n iptables-save | curl -F 'f:1=<-' ix.io
INSTALLS ?= nginx-linkerd nginx-bare
define getsvc
kubectl get svc --all-namespaces -l app=nginx-ingress \
--no-headers
endef
define lbip
$(call getsvc) \
#!/usr/bin/env python3
import io
import re
import subprocess
import sys
import uuid
from contextlib import contextmanager
function expandSibling(el) {
var chevron = el.querySelector("td:first-child > i").classList;
chevron.toggle("fa-angle-down");
chevron.toggle("fa-angle-right");
el.nextElementSibling.classList.toggle("hide");
}
---
apiVersion: v1
kind: Namespace
metadata:
name: tracing
---
apiVersion: v1
kind: ConfigMap
metadata:
name: oc-agent
# Cluster management tools.
# See https://github.com/grampelberg/k8s-clusters for updates and documentation.
export CLUSTER_NAME ?= $(shell cat tmp/current 2>/dev/null || echo $$(whoami)-dev)
export MACHINE_TYPE ?= n1-standard-2
export DISK_SIZE ?= 100
export MAX_NODES ?= 10
export NETWORK ?= dev
export PROJECT ?= foobar
export VERSION ?= latest
.PHONY: build
build:
ifeq ($(OS),Darwin)
$(MAKE) build-darwin
endif
$(MAKE) build-linux
.PHONY: build
build: build-$(OS)
command: ["python", "-c"]
args:
- |-
import time
while True:
print('.')
time.sleep(5)
# Cluster management tools.
export CLUSTER_NAME ?= $(shell cat tmp/current 2>/dev/null || echo $$(whoami)-dev)
export MACHINE_TYPE ?= n1-standard-2
export DISK_SIZE ?= 100
export MAX_NODES ?= 10
export NETWORK ?= dev
export PROJECT ?= runconduit
export VERSION ?= latest
export ZONE ?= us-west1-a
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: slow-cooker
namespace: leaderboard
spec:
replicas: 1
template: