Skip to content

Instantly share code, notes, and snippets.

@zparnold
zparnold / one_liner.sh
Last active June 21, 2025 06:24
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@zparnold
zparnold / main.tf
Last active January 6, 2024 09:18
The combined Terraform file for creating a very simple EKS cluster
variable "cluster-name" {
default = "terraform-eks-demo"
type = string
}
# This data source is included for ease of sample architecture deployment
# and can be swapped out as necessary.
data "aws_availability_zones" "available" {}
resource "aws_vpc" "demo" {
@zparnold
zparnold / k8srequiredprobes.yaml
Last active August 23, 2022 12:11
A Gatekeeper Constraint Template (for AKS's implementation of Gatekeeper) capable of requiring liveness, readiness, and startup probes with exclusions for pod labels and container names
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: k8sazurecontainerprobesrequired
spec:
crd:
spec:
names:
kind: K8sAzureContainerProbesRequired
validation:
@zparnold
zparnold / line_counter.go
Created September 25, 2020 17:26
You can use this to count all the lines in a directory
package main
import (
"bytes"
"fmt"
"io"
"log"
"math/big"
"os"
"path/filepath"
@zparnold
zparnold / ena_setup_on_ec2.sh
Created March 8, 2018 18:40
Run this script on Ubuntu to enable ENA support.
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
#you may get an error E: Failed to fetch https://sdkrepo.atlassian.com/debian/dists/stable/contrib/binary-amd64/Packages 404 Not Found
#don't worry, you can continue without harm
sudo apt-get install -y build-essential dkms
git clone https://github.com/amzn/amzn-drivers
sudo mv amzn-drivers /usr/src/amzn-drivers-1.5.1
sudo touch /usr/src/amzn-drivers-1.5.1/dkms.conf
echo 'PACKAGE_NAME="ena"
PACKAGE_VERSION="1.5.1"
@zparnold
zparnold / database.yml
Last active March 27, 2019 21:23
An extendable, DRY Rails database file
#chances are you use the same port and adapter everywhere
default: &default
adapter: mysql2
reconnect: true
port: 3306
#we use docker compose locally, so these settings stay the same
local: &local
<<: *default
username: root
helm plugin install https://github.com/hypnoglow/helm-s3.git
helm repo add zparnold s3://zparnold-helm/charts
helm install zparnold/hacksploit
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: manager-service
spec:
hosts:
- "ops.acceptance.ygreneworks.com"
gateways:
- manager-gateway
http:
apiVersion: "networking.istio.io/v1alpha3"
kind: "DestinationRule"
metadata:
name: "manager-istio-client-mtls"
spec:
host: ygrene-manager-service.acceptance.svc.cluster.local
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: stripe-external
spec:
hosts:
- "api.stripe.com"
ports:
- number: 443
name: https