This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list taints (all nodes) | |
kubectl get nodes -o json | jq -r '.items[] | .metadata.name + " " + .spec.taints[]?.key + "=" + .spec.taints[]?.key + ":" + .spec.taints[]?.effect' | |
# list taints (exclude control plane) | |
kubectl get nodes -o json -l '!node-role.kubernetes.io/control-plane' | jq -r '.items[] | .metadata.name + " " + .spec.taints[]?.key + "=" + .spec.taints[]?.key + ":" + .spec.taints[]?.effect' | |
# remove taint example (note: the hyphen after the taint to remove) | |
# kubectl taint nodes $NODE $TAINT- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set -Eeou pipefail | |
# kubectl_get_images.sh | |
# | |
# Use kubectl to get all running images in a Kubernetes cluster. | |
# Ref: https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/ | |
# if context is provided, switch context | |
if [[ ! -z ${1:-} ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add all yaml configs under ${HOME}/.kube to KUBECONFIG | |
export KUBECONFIG=~/.kube/config$(for YAML in $(find ${HOME}/.kube -name '*.y*ml') ; do echo -n ":${YAML}"; done) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In switching Git repositories, I found you must delete the ArgoCD ApplicationSets and | |
# Applications in order to allow ArgoCD to recreate. However, deleting the resources can | |
# hang due to finalizers. Run the below script to reset the ArgoCD Application finalizers: | |
# get argocd applications by name, one per row | |
APPS=$(kubectl get -n ${NAMESPACE:-argocd} applications.argoproj.io -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{"\n"}{end}') | |
# loop through and reset each application's finalizers | |
while read -r APP; do | |
kubectl patch -n ${NAMESPACE:-argocd} applications.argoproj.io/$APP -p '{"metadata":{"finalizers":[]}}' --type=merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create alias | |
test() { | |
local URL=${1:?URL is required as first argument} | |
local TIMEOUT=${TIMEOUT:-1} | |
local SLEEP=${SLEEP:-1} | |
while true; do curl -s -m $TIMEOUT $URL > /dev/null && echo -n ✅ || echo -n 💀; sleep $SLEEP; done | |
} | |
# usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -Eeuo pipefail | |
echo | |
: ${NAMESPACE:?NAMESPACE is required} | |
: ${SERVICE:?SERVICE is required} | |
: ${FLOATING_IP:?FLOATING_IP is required} | |
echo "VERIFY FLOATING IP: $FLOATING_IP" | |
while true; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: metallb-health | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to read and format ConfigMap data from file | |
configmap_from_file() { | |
local FILE=${1:?FILE is required} | |
local INDENT=${2:-4} | |
local SPACES=$(printf ' %.0s' {1..$INDENT}) | |
echo "|" && cat $FILE | sed "s/^/$SPACES/" | |
} | |
################################################## | |
# usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get hosts (mgr node) | |
HOSTS=$(docker node ls --format "{{.Hostname}}") | |
# print host/ip | |
for HOST in $HOSTS; do host $HOST; done | awk '{print $1, $4}' | sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( 0.1 + 0.2 === 0.3 ) ? console.log('LGTM') : console.log('WTF'); |
NewerOlder