Skip to content

Instantly share code, notes, and snippets.

View stealthybox's full-sized avatar

leigh capili stealthybox

View GitHub Profile
@stealthybox
stealthybox / env.sh
Created September 24, 2019 00:51
Home Local Go - shell script that downloads and links different versions of go into your ~/.local directory
# source this from your shell's profile
# Go Binaries linked to my homedir
export GOROOT=$HOME/.local/usr/local/go
export PATH=$PATH:$GOROOT/bin
# User Binaries
export PATH=$PATH:$HOME/go/bin
# User GOPATH for backwards-compat
export GOPATH=$HOME/go
@stealthybox
stealthybox / dev-cluster.sh
Created October 1, 2019 16:54
kinder dev cluster that mounts kubernetes binaries -- use with https://github.com/kubernetes/kubeadm/tree/master/kinder
#!/bin/sh
# setup a kinder cluster with the bazel and output directories mounted
set -eu
binary="kubeadm"
kube_root="${kube_root:-${GOPATH:-${HOME}/go}/src/k8s.io/kubernetes}"
bazel_binpath="bazel-bin/cmd/${binary}/linux_amd64_pure_stripped/"
output_binpath="_output/local/bin/linux/amd64/"

Keybase proof

I hereby claim:

  • I am stealthybox on github.
  • I am stealthybox (https://keybase.io/stealthybox) on keybase.
  • I have a public key whose fingerprint is 05E7 89C9 142C DD05 8261 4EF8 5943 2144 444F B382

To claim this, I am signing this object:

@stealthybox
stealthybox / README.md
Last active July 15, 2022 01:55
Does anyone have an example k8s deployment with RBAC permissions to run something like `kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes` ? https://twitter.com/rothgar/status/1544934007397175297

This is a tested example.
Not all clusters will have the metrics API, but this will function for ones that do.

The deployment uses the bitnami/kubectl image. It runs "get node metrics" in a shell while loop that sleeps.

The Deployment's Pod-template uses a ServiceAccount that is ClusterRoleBound to a ClusterRole permitting the list and get verbs for the Node kind in the metrics.k8s.io API group.

Here's how to reproduce:

@stealthybox
stealthybox / lifecycle.ytt.yaml
Last active April 25, 2024 21:15
PreStop Sleep lifecycle patches /w the v1.29 Kubernetes Pod API changes
#@ load("@ytt:overlay", "overlay")
#@ def pod_lifecycle_patch():
spec:
#@overlay/match-child-defaults expects="0+"
containers:
#@overlay/match by=overlay.all
- lifecycle:
#! This "sleep" preStop hook delays the
#! Pod shutdown until after our Ingress