Skip to content

Instantly share code, notes, and snippets.

@simonswine
simonswine / kubectl_root_host.sh
Created May 29, 2018 16:23
nsenter into the host
kubectl run hack1 --restart=Never -t -i -n kube-system --image overridden --overrides '{"spec":{"hostPID": true, "containers":[{"name":"busybox","image":"alpine:3.7","command":["nsenter","--mount=/proc/1/ns/mnt","--","/bin/bash"],"stdin": true,"tty":true,"securityContext":{"privileged":true}}]}}' --rm --attach
@simonswine
simonswine / calico.yaml
Last active April 21, 2020 23:27
Calico 2.6.2 yaml working on SELinux + DaemonSet upgrades
# Calico Version v2.6.2
# https://docs.projectcalico.org/v2.6/releases#v2.6.2
# This manifest includes the following component versions:
# calico/node:v2.6.2
# calico/cni:v1.11.0
# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
apiVersion: v1
metadata:
$ kubectl get cs 1 ↵
NAME STATUS MESSAGE ERROR
controller-manager Unhealthy Get http://127.0.0.1:10252/healthz: dial tcp 127.0.0.1:10252: getsockopt: connection refused
scheduler Unhealthy Get http://127.0.0.1:10251/healthz: dial tcp 127.0.0.1:10251: getsockopt: connection refused
etcd-0 Healthy {"health": "true"}
$ kubectl describe nodes aks-agentpool1-21574822-2
Name: aks-agentpool1-21574822-2
Roles: agent
Labels: agentpool=agentpool1
@simonswine
simonswine / openwrt_lede_pkg_diff.sh
Created October 18, 2017 20:54
List installed packages after ROM was installed on OpenWRT/LEDE
# show pages installed since ROM
opkg list_installed | sort > /tmp/installed_now
opkg list_installed -o /rom | sort > /tmp/installed_rom
grep -Fxv -f /tmp/installed_rom /tmp/installed_now | tee /tmp/installed_diff
# echo installable list of packages
cat /tmp/installed_diff | cut -f 1 -d ' ' | xargs
#!/bin/bash
_term() {
echo "Caught SIGTERM signal, wait for 30s before forwarding it to gunicorn"
sleep 30
kill -TERM "$pid" 2>/dev/null
}
trap _term SIGTERM
$ terraform apply
libvirt_cloudinit.master: Refreshing state... (ID: /var/lib/libvirt/images/k8s-master-clou...g;5969f69a-6d83-db3b-fc21-3194e29f6138)
libvirt_network.network: Refreshing state... (ID: f9d0bfad-c7ec-46c1-bc0e-0ed393322f7d)
libvirt_volume.centos-7: Refreshing state... (ID: /var/lib/libvirt/images/base-centos-7-1706.qcow2)
libvirt_volume.master: Refreshing state... (ID: /var/lib/libvirt/images/k8s-master-1.qcow2)
libvirt_domain.master: Refreshing state... (ID: 55cc32b2-2d7f-4656-a4ba-359d40df3a12)
libvirt_cloudinit.master: Destroying... (ID: /var/lib/libvirt/images/k8s-master-clou...g;5969f69a-6d83-db3b-fc21-3194e29f6138)
libvirt_cloudinit.master: Destruction complete
libvirt_cloudinit.master: Creating...
local_hostname: "" => "master-1"

Keybase proof

I hereby claim:

  • I am simonswine on github.
  • I am simonswine (https://keybase.io/simonswine) on keybase.
  • I have a public key whose fingerprint is D29F 745D D48C A0E0 C33A 7B08 1FF2 C09C 6204 5ED2

To claim this, I am signing this object:

antigen use oh-my-zsh
antigen theme bira
antigen bundles <<EOBUNDLES
zsh-users/zsh-syntax-highlighting
git
tmux
EOBUNDLES
2016/08/16 08:29:54 [INFO] Terraform version: 0.7.0 e822a79165dbc06bbf8271ee349fe256867d53dc
2016/08/16 08:29:54 [DEBUG] Detected home directory from env var: /home/christian
2016/08/16 08:29:54 [DEBUG] Detected home directory from env var: /home/christian
2016/08/16 08:29:54 [DEBUG] Attempting to open CLI config file: /home/christian/.terraformrc
2016/08/16 08:29:54 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/08/16 08:29:54 [DEBUG] Detected home directory from env var: /home/christian
2016/08/16 08:29:55 [TRACE] Graph after step *terraform.ConfigTransformer:
google_container_cluster.default-infra - *terraform.GraphNodeConfigResource
var.default_zone - *terraform.GraphNodeConfigVariable
@simonswine
simonswine / .vimrc
Created August 11, 2016 07:20
.vimrc 2016-08-10
" .vimrc
"
" Install vundle
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"
" Launch vim and run
" :VundleInstall
" Disable compatability
set nocompatible