Skip to content

Instantly share code, notes, and snippets.

View BondAnthony's full-sized avatar
👋
Hi!

AJ BondAnthony

👋
Hi!
View GitHub Profile
@BondAnthony
BondAnthony / telegraf-k8s.md
Last active October 10, 2019 13:03
Kubernetes deployment for Telegraf Webhook Input

Telegraf Kubernetes Deployment Github Events

This deployment will run Telegraf on Kubernetes. This will create a single pod configured to receive webhook events from configured repositories.

Dependencies:

  • You must be running nginx ingress controller within your cluster.
  • Your cluster should be running external dns with a configured domain and zone. This allows for DNS records to be created automatically.
  • Certmanager should be used to handle creating TLS certificates.
  • You should already or can create the required credentials for your Telegraf input and output endpoints.

Flux

Here are some examples of Flux queries

Process Uptime

import "system"
from(bucket: "apps")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)

Google Cloud Platform

Google Compute Engine

Just like other cloud providers Google allows for startup scripts. Once nice thing about GCE is you can easily restart your startup script for debugging reasons.

Login and run the following command to restart the startup script.

sudo google_metadata_script_runner --script-type startup --debug

Fluentd parser for Kubernetes Nginx Ingress

    <match kubernetes.**>
      @id kubernetes_nginx_tag
      @type rewrite_tag_filter
      @log_level trace
      <rule>
        key kubernetes_container_name
        pattern /^ingress-nginx$/
        tag kubernetes.nginx
@BondAnthony
BondAnthony / tcpdump.md
Last active March 22, 2021 16:15
All those handy tcpdump rules

tcpdump

Capture all upd traffic being sent to destination port range 1-1023. Helps when your debugging dns traffic

sudo tcpdump -n udp dst portrange 1-1023

Capture packets being sent to a specific destination host ip.

@BondAnthony
BondAnthony / AWS-CLI.md
Last active January 29, 2024 19:12
Those useful AWS cli commands
for i in $(aws ec2 describe-regions | jq -r '.Regions[].RegionName'); do
echo "Region ${i} --------"
aws ec2 describe-vpcs --region ${i} | jq '.Vpcs[].CidrBlock'
aws ec2 describe-subnets --region ${i} | jq '.Subnets[].CidrBlock'
done

Fetch Volumes

@BondAnthony
BondAnthony / kubectl.md
Last active November 4, 2019 22:21
Kubectl Tricks & Tips I Always Forget

Kubectl Commands

Node Data

Get a list of pods on for each node based on node status that is unschedulable

for i in $(kubectl get nodes -o wide -L my.label/type --field-selector spec.unschedulable=true |sed 1d | awk '{print $1}'); do
  kubectl get pods --all-namespaces --field-selector spec.nodeName=${i} -o wide
done
@BondAnthony
BondAnthony / git.md
Last active October 7, 2023 07:48
Git!

Helpful Git Commands

Git log in a pretty format

git log --graph --decorate --pretty=oneline --abbrev-commit

Clean up merged branches from local

git fetch -p &amp;&amp; for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do echo "Delete: ${branch}"; git branch -D ${branch}; done