Skip to content

Instantly share code, notes, and snippets.

@echo-devnull
echo-devnull / es_reboot.yml
Created February 8, 2023 18:46
Rebooting elastic search nodes one by one
---
- hosts: elasticsearch
serial: 1
become: true
user: ansible
# First we make sure the cluster is not in a weird state before we begin rebooting
# That would be bad.
@echo-devnull
echo-devnull / r00t container
Created November 4, 2022 21:01
Creating a container thas has access to the node it's running on
r00t() {
if [ -n "$1" ]
then
kubectl run r00t --restart=Never -it --rm --image f00 --overrides "{\"spec\":{\"hostNetwork\": true, \"hostPID\": true, \"containers\": [{\"name\":\"1\",\"image\":\"alpine\",\"command\":[\"nsenter\",\"--mount=/proc/1/ns/mnt\",\"--\",\"/bin/sh\"],\"stdin\":true, \"tty\":true,\"securityContext\":{\"privileged\":true}}],\"nodeSelector\":{\"kubernetes.io/hostname\":\"$1\"},\"tolerations\":[{\"key\":\"node-role.kubernetes.io/etcd\",\"operator\":\"Exists\",\"effect\":\"NoExecute\"},{\"key\":\"node-role.kubernetes.io/controlplane\",\"operator\":\"Exists\",\"effect\":\"NoSchedule\"}]}}"
fi
}
@echo-devnull
echo-devnull / kubernetes.zsh
Created November 4, 2022 21:00
Merging seperate kubeconfig files into one
function mergeKubeConfigs() {
kube_config_dir="$HOME/.kube/config.d/"
for f in `ls $kube_config_dir | grep config.`
do
export KUBECONFIG="$kube_config_dir/$f:$KUBECONFIG";
done
kubectl config view --raw >> ~/.kube/config
unset KUBECONFIG
export KUBECONFIG="$HOME/.kube/config"
}

Keybase proof

I hereby claim:

  • I am echo-devnull on github.
  • I am maas (https://keybase.io/maas) on keybase.
  • I have a public key ASBz3EnjKXK48LXzk3cS3kBmcYZOQ80fTumIbv-3OafQqQo

To claim this, I am signing this object:

@echo-devnull
echo-devnull / Mark_pub.key
Last active July 11, 2021 19:07
OpenGPG public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGDrPX4BEADNt0aJQKA7jR8ANQJDx7KDUcI0SclRwrSbLwskDMcSPr5dTnWa
Ypxca0FB5Oprcx0g9URpt0XIfgC5iJst5RynlMNeXQhA5DWc3mcJkVN8Nf9FdHce
bW86wZOQiVfwPK8sQdEfyx8olgLzI9OJ99z3TpXi+KPM3XxOQVcgunwnDYcSdGZ2
fav/I1uyh8EQ6g3SSQU9LGov+UfqFOCWfYu1nBN4d9tpzr79c15JlbR6FJtArVSv
gE51gZbXkp2p+AahdAiU+tdZm6MAWK/Gg0kp3L7Q6ngWyLS0In1ndMdV7V1nH8j9
9fsbUHKGX9BDF2utvS6KqcyKhB+msGc7ocGewH95osF3j+Rca/5wYVWqSkyT8t7z
X5VI/t/Y+acK3s4ZtK8ZfjCElsPPyiRLxHbk+MZiNacUoVKCk7TPlOjbwjBz89Nq
zOuuJetM1Fn1LakrN1VN99bVVosdKdetN9PMo26ggiXwQ0I6SAQtFTTazgCOz5Zn
@echo-devnull
echo-devnull / Vagrantfile
Last active January 13, 2021 05:58
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos/7"
config.ssh.insert_key = false
#------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
# Hint: some features are disabled by default, remove the leading # to enable
# them.
# Set to 0 to disable, 1 to enable TLP.
TLP_ENABLE=1
---
- hosts: percona
serial: 1
# First we make sure the cluster is not in a weird state before we begin rebooting
# That would be bad.
pre_tasks:
# Right! Before we begin a reboot, first check if the cluster is green
@echo-devnull
echo-devnull / ZSH
Created September 10, 2018 07:12
Creating autocompletion and aliases
if [ $commands[kubectl] ]; then
source <(kubectl completion zsh)
fi
if [ $commands[kops] ]; then
source <(kops completion zsh)
fi
# Stop and Remove all containers
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
# Lazy Git
function lg() {
git add .
git commit -a -m "$1"
git pull
git push
}
# End Lazy G