Skip to content

Instantly share code, notes, and snippets.

@fjudith
fjudith / kubernetes_service_session_affinity.md
Last active February 6, 2025 12:15
Enable Session Affinity (a.k.a Sticky Session) to Kubernetes service
@zparnold
zparnold / one_liner.sh
Last active January 13, 2025 17:40
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
@nash403
nash403 / .bashrc
Last active April 29, 2024 04:59
Automatically enable/disable proxy settings from command line
# Show proxy settings
function proxy_show(){
env | grep -e _PROXY -e _proxy | sort
}
# Configure proxy
function proxy_on(){
# You may need to hardcode your password, proxy server, and proxy port
# if the following variables do not exist
export HTTP_PROXY="http://$USERNAME:$PASSWORD@$PROXY_SERVER:$PROXY_PORT"
@juliohm1978
juliohm1978 / k8s-drain.sh
Last active December 9, 2024 17:27
Drains a Kubernetes node using "rollout restart" instead "kubectl drain". See comments for motiviation and usage.
#!/bin/bash
NODE_NAME=$1
ROLLOUT_CMD=$2
if [[ "$NODE_NAME" == "" ]]; then
echo "
USAGE: ./drain.sh <NODE_NAME>
Drains a node from its Deployments/Stateful set pods.