Skip to content

Instantly share code, notes, and snippets.

@PabloHiro
PabloHiro / .vimrc
Last active January 27, 2022 17:49
.vimrc
" Reference:
" http://nvie.com/posts/how-i-boosted-my-vim/
"
" Most general settings first
set nocompatible " set Vim rather than Vi settings; must go first
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set expandtab " spaces instead of tabs
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set hlsearch " highlight search terms
@PabloHiro
PabloHiro / .bashrc
Last active March 14, 2024 12:05
My bashrc
# Custom environment variables
export GIT_EDITOR=/usr/bin/vim
export EDITOR=/usr/bin/vim
export VISUAL=/usr/bin/vim
# Command for git root
git config --global alias.root "rev-parse --show-toplevel"
# Custom aliases
alias l='ls'
@PabloHiro
PabloHiro / kubectl.md
Last active September 15, 2023 07:32
Kubectl tips and tricks

Troubleshooting

kubectl run -it --rm --image=wbitt/network-multitool network-multitool -- sh

Top of pods in a node

kubectl get pods --all-namespaces -o wide | grep NODE_NAME | awk '{print $1" "$2}' | xargs -n2 kubectl top pods --no-headers --namespace | sort -t ' ' --key 2 --numeric --reverse

List pods resources requests

kubectl get pod -A -o custom-columns="Name:metadata.name,CPU-request:spec.containers[*].resources.requests.cpu,CPU-limit:spec.containers[*].resources.limits.cpu,Memory-request:spec.containers[*].resources.requests.memory,Memory-limits:spec.containers[*].resources.limits.memory"

List per node resources requests and limits

---
apiVersion: v1
kind: Pod
metadata:
name: test
namespace: default
spec:
containers:
- command:
- sh
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sharedvolume-claim
spec:
accessModes:
- ReadWriteMany
resources:
requests:
apiVersion: v1
kind: Pod
metadata:
name: sleeping-pod
spec:
containers:
- name: test
image: bash
command: ["sh", "-c", "tail -f /dev/null"]
@PabloHiro
PabloHiro / tekton-housekeeping.md
Created May 18, 2023 14:19
Cleaning up Tekton pipeline runs

TEKTON HOUSEKEEPING

Delete failed pipelineruns:

kubectl -n target-namespace delete pipelinerun $(kubectl -n target-namespace get pipelinerun -o jsonpath='{range .items[?(@.status.conditions[*].status=="False")]}{.metadata.name}{"\n"}{end}')

Delete successful pipelineruns:

kubectl -n target-namespace delete pipelinerun $(kubectl -n target-namespace get pipelinerun -o jsonpath='{range .items[?(@.status.conditions[*].status=="True")]}{.metadata.name}{"\n"}{end}')
URL=https://chartmuseum.example.com
CHART_NAME=argo-cd
CHART_VERSION=1.0.5
TOKEN=dXNlcm5hbWU6cGFzc3dvcmQ=
curl -X DELETE $URL/api/charts/$CHART_NAME/$CHART_VERSION -H "Authorization: Basic $TOKEN"