Skip to content

Instantly share code, notes, and snippets.

View jessesanford's full-sized avatar

Jesse Sanford jessesanford

View GitHub Profile
@mustafakirimli
mustafakirimli / enable_vmx.sh
Last active December 15, 2022 20:02
Enable nested virtualization on GKE (be careful when running)
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# $IG_URLS as env
# GET auth token to be used in curl/rest api
AUTH_TOKEN=$(gcloud auth print-access-token)
@jessesanford
jessesanford / ssl.sh
Last active February 23, 2021 20:35 — forked from alex-leonhardt/ssl.sh
Create signed SSL cert with K8S CA
#! /bin/bash
set -o errexit
export APP="${1:-mutateme}"
export NAMESPACE="${2:-default}"
export CSR_NAME="${APP}.${NAMESPACE}.svc"
echo "... creating ${app}.key"
openssl genrsa -out ${APP}.key 2048
@Piotr1215
Piotr1215 / k8s-bookmarks-CKA-CKAD.html
Last active January 4, 2024 18:15
K8s bookmarks for CKA, CKAD and CKS exams
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1626629115" LAST_MODIFIED="1626629462" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@MCMrARM
MCMrARM / 91-pulseaudio-custom.rules
Created August 30, 2019 19:22
System configuration files for the T2 audio driver (https://github.com/MCMrARM/mbp2018-bridge-drv/)
SUBSYSTEM!="sound", GOTO="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"
SUBSYSTEMS=="pci", ATTRS{vendor}=="0x106b", ATTRS{device}=="0x1803", ENV{PULSE_PROFILE_SET}="apple-t2.conf"
LABEL="pulseaudio_end"
@alex-leonhardt
alex-leonhardt / ssl.sh
Created July 27, 2019 14:42
Create signed SSL cert with K8S CA
#! /bin/sh
set -o errexit
export APP="${1:-mutateme}"
export NAMESPACE="${2:-default}"
export CSR_NAME="${APP}.${NAMESPACE}.svc"
echo "... creating ${app}.key"
openssl genrsa -out ${APP}.key 2048
@jessesanford
jessesanford / .chunkwmrc
Created January 3, 2019 19:05 — forked from shihanng/.chunkwmrc
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
@jjo
jjo / kubectl-root-in-host-nopriv.sh
Last active February 5, 2024 23:07
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
node=${1}
case "${node}" in
"")
nodeSelector=''
podName=${USER+${USER}-}docker-any
@jasonmcintosh
jasonmcintosh / aws-creds.sh
Last active April 27, 2020 22:29
aws-creds helper script
#!/bin/bash
VAULT_PATH=$1
ROLE=$2
DURATION=$3
if [ -z "$VAULT_ADDR" ]; then
echo "Missing VAULT_ADDR env variable"
exit 1
fi
if [ -z "$VAULT_PATH" ]; then

MutatingAdmissionWebhook Example with OPA

This is a quick example of how to use OPA as a Mutating Admission Controller in Kubernetes 1.9.

Steps

  1. Register OPA as a MutatingAdmissionWebhook
  2. Load a policy to test mutation
  3. Exercise the policy
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#