Skip to content

Instantly share code, notes, and snippets.

View BondAnthony's full-sized avatar
👋
Hi!

AJ BondAnthony

👋
Hi!
View GitHub Profile

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

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
@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.
@BondAnthony
BondAnthony / PostgreSQL.md
Created October 17, 2019 19:32
PostgreSQL

PostgreSQL

Easy way to interact with a database

docker run -it --rm postgres psql -h hostname -U user
@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 / Random.md
Created November 14, 2019 16:03
Random stuff I can't remember

CoreOS

Toolbox for CoreOS

docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock --net=host  nicolaka/netshoot ctop

Keybase proof

I hereby claim:

  • I am bondanthony on github.
  • I am bondanthony (https://keybase.io/bondanthony) on keybase.
  • I have a public key whose fingerprint is D41B 91E6 A7E5 06B6 8F9E F1B2 3041 BB87 8C89 EF7D

To claim this, I am signing this object:

@BondAnthony
BondAnthony / github-api.md
Last active May 22, 2020 14:37
Github GraphQL

Github API

Queries to return issues based on milestone

Variables

{
  "owner": "bondanthony",
  "name": "ansible-plays"
}
@BondAnthony
BondAnthony / terraform-actions.md
Last active November 12, 2020 15:56
Terraform monorepo actions

Terraform + Github Actions

I struggled to get the right mix of github actions to lint my terraform modules within a monorepo. Here is the configuration I settled on which dynamically creates new jobs based on the data within the project.

I use a module naming pattern of provider-module_name, which becomes aws-kubernetes or gcp-gke. This information is important because the action executes the following command to create a list of modules.

$(printf '\"%s\"', gcp-* aws-* azure-* | sed 's/,$//')
@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.