Skip to content

Instantly share code, notes, and snippets.

@rverchere
rverchere / kube-state-metrics-vpa.yaml
Last active February 9, 2025 11:11
kube-state-metrics configuration for VPA metrics
## Kube State Metrics to get VPA metrics
# Old vs New metrics:
# - kube_verticalpodautoscaler_labels -> kube_customresource_verticalpodautoscaler_labels
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_target
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget
# Resources:
# - https://github.com/kubernetes/kube-state-metrics/blob/main/docs/customresourcestate-me
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 21, 2025 17:51
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@akhenakh
akhenakh / app.yaml
Last active March 4, 2023 19:22
Example of graceful shutdown with grpc healthserver * httpserver
readinessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 1
livenessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 2
imagePullPolicy: IfNotPresent
#!/usr/bin/env bash
set -e
for full_name in $(kubectl get all -o name | grep -vE replicaset\|pod); do
name="$(echo "$full_name" | sed -e "s/.*\///g")";
type="$(echo "$full_name" | sed -e "s/\/.*//g")";
case "${type}" in
deployment*)
type=Deployment
;;
"service")
@bwhaley
bwhaley / cassandra-rolling-restart.yml
Created October 30, 2017 22:33
Ansible playbook for graceful rolling restart of the nodes in a cassandra cluster
- hosts: "*"
become: True
serial: 1
tasks:
- name: Initiate graceful shutdown
shell: "nodetool {{item}} && sleep 5"
with_items:
- disablethrift
- disablebinary
- disablegossip
@tolitius
tolitius / nginx.conf
Last active June 24, 2023 10:03
openresty (nginx + lua): redis connection pooling
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
init_worker_by_lua_block {
redis = require("resty.redis")
}
server {
@dbaston
dbaston / Dockerfile
Created March 29, 2016 14:51
Dockerfile to build pramsey's parallel PostGIS branch against Postgres/GEOS trunk
FROM phusion/baseimage
RUN apt-get update && apt-get install -y \
build-essential \
git \
bison \
flex \
zlib1g-dev \
autoconf \
libtool \
@manelclos
manelclos / s3signurl.py
Last active February 9, 2018 19:23 — forked from obeattie/s3signurl.py
Quick, dirty Python script that spits out a signed url for Amazon S3
#!/usr/bin/env python
import optparse
import sys
import os
os.environ['S3_USE_SIGV4'] = 'True'
from boto.s3.connection import S3Connection
def sign(bucket, path, access_key, secret_key, https, expiry, host=None):
@mkanchwala
mkanchwala / Kafka MultiNode - MultiBroker Cluster.md
Last active July 2, 2022 10:44
Create Kafka Multi Node, Multi Broker Cluster