Skip to content

Instantly share code, notes, and snippets.

View tyrannasaurusbanks's full-sized avatar

Ioan tyrannasaurusbanks

  • Hotels.com
  • London
View GitHub Profile
@tyrannasaurusbanks
tyrannasaurusbanks / management.slack
Last active January 17, 2020 16:37
Incident management tool (imtc)
## Use comands from hcom-spam
## Create
imtc inc create | p1 | Incident: Prod-decaf us-west-2 cluster severely degraded | Description: APIServers were knocked offline so cluster & dependent services have been in a degraded state. | --env=5 --mailto=HTechAll@expedia.com
## Update
imtc inc update | INC4025633 | Bringing forward roll of the cluster to flush out authentication issues. Trying to locate start of the disruption and identify root cause.
## Resolve
imtc inc resolve | INC4664828 | Control plane restored and ephemeral storage enlarged cleanly | --enddate=2020-01-17-15:58
@tyrannasaurusbanks
tyrannasaurusbanks / ssh-on-to-nodes-in-cluster.sh
Last active August 15, 2019 14:36
Shell onto nodes in cluster
# SSH onto node hosting last-created pod
kubectl get pods -n mantle -l=app=mantle-node-problem-detector -o jsonpath='{.items[0].status.hostIP}' --sort-by="metadata.creationTimestamp" | tail -n1 | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
# SSH onto master
kubectl get nodes -l=kubernetes.io/role=master -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}' | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
# SSH onto every node
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}' | xargs -0 bash -ic 'csshx -y 2 -x 2 -l core $@' --
@tyrannasaurusbanks
tyrannasaurusbanks / show-az.sh
Created September 5, 2018 16:02
Show AZ's of all running pods
for i in $(kubectl get pods -n perf -l k8s-app=sli-recorder-wl -o=jsonpath='{.items[*].spec.nodeName}'); do echo "****** $i ******"; kubectl get node $i -o=jsonpath="{.metadata.labels.failure-domain\.beta\.kubernetes\.io\/zone}" | xargs echo "$i is in AZ = "; done
@tyrannasaurusbanks
tyrannasaurusbanks / amend-author.sh
Last active February 8, 2022 14:16
Change git author/committer
# Update a previous commits author details
GIT_AUTHOR_EMAIL=email GIT_AUTHOR_NAME=username GIT_COMMITTER_EMAIL=email GIT_COMMITTER_NAME=username git commit --reset-author --amend
@tyrannasaurusbanks
tyrannasaurusbanks / kubernetes-autoscaler-dashboard.json
Last active January 4, 2020 03:55
Grafana dashboard for the kubernetes autoscaler
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
$ glide -version
glide version v0.12.3
$ glide cc && glide get github.com/Masterminds/sprig
[INFO] Glide cache has been cleared.
[INFO] Preparing to install 1 package.
[INFO] Attempting to get package github.com/Masterminds/sprig
[INFO] --> Gathering release information for github.com/Masterminds/sprig
[INFO] The package github.com/Masterminds/sprig appears to have Semantic Version releases (http://semver.org).
[INFO] The latest release is 2.10.0. You are currently not using a release. Would you like
@tyrannasaurusbanks
tyrannasaurusbanks / pipe-down.sh
Created May 2, 2017 09:10
Scale down deployments if their ingress hasn't had any traffic - source: https://carlosbecker.com/posts/k8s-sandbox-costs/
#!/bin/bash
# Source: https://carlosbecker.com/posts/k8s-sandbox-costs/
set -eo pipefail
ingress="$(kubectl get pods --output=jsonpath='{.items[*].metadata.name}' |
xargs -n1 | grep "ingress-nginx" | head -n1)"
# cache all hosts that pass through the ingress
hosts="$(kubectl get ingress nginx-ingress --output=jsonpath='{.spec.rules[*].host}' | xargs -n1)"
diff --git a/glide.lock b/glide.lock
index b55b95f..48bd4d5 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,8 +1,10 @@
-hash: c867da102c81c3ad5b5b7e9016f1b020fe22311da8f3532b65a0a2832f0b0b3c
-updated: 2017-03-12T18:50:39.127225917+01:00
+hash: 61650b1ec198a8e63d341908512a136ee16a45bd82e46f71945f807ccbee2715
+updated: 2017-04-21T13:30:43.843733482+01:00
imports:
@tyrannasaurusbanks
tyrannasaurusbanks / set_git_config.sh
Created February 10, 2017 09:14
Set auto rebasing to avoid big tree when pull new changes
git config --global branch.autosetuprebase=always
@tyrannasaurusbanks
tyrannasaurusbanks / is flannel working?
Created May 17, 2016 12:56
Quick pseduo code to test flanneld networking between hosts
ssh <host1>
CONTAINER=$(docker run -p 9999:9999 -d ubuntu:14.04 nc -l 9999)
IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER)
docker logs -f $CONTAINER
<ssh host2>
docker run --entrypoint /bin/bash -ti ubuntu:14.04 -i
echo "Hello ioan!" | nc $IP 9999