Skip to content

Instantly share code, notes, and snippets.

View bubeamos's full-sized avatar

Amos, Chidiebube bubeamos

  • Canada
View GitHub Profile
@bubeamos
bubeamos / 0_kubernetes_snippets.md
Created March 28, 2023 13:28 — forked from rubberduck203/0_kubernetes_snippets.md
Cordon all Kubernetes Nodes

Some bits and pieces of useful commands for working with k8s

@bubeamos
bubeamos / cfn-delete.sh
Created March 9, 2023 21:34 — forked from ameir/cfn-delete.sh
Delete CloudFormation stacks based on prefix or regex
#!/usr/bin/env bash
set -euo pipefail
export AWS_PAGER=""
REGEX="^prefix-"
WAIT=true
stacks=$(aws cloudformation describe-stacks --query Stacks[].StackName --output=text)
for stack in $stacks; do
if [[ $stack =~ $REGEX ]]; then
for CLUSTER in $(aws ecs list-clusters --output=text | awk '{print $2}')
do
for SERVICE in $(aws ecs list-services --cluster=$CLUSTER --output text | awk '{print $2}')
do
for TASK in $(aws ecs list-tasks --cluster=$CLUSTER --service-name=$SERVICE --output=text | awk '{print $2}')
do
aws ecs describe-tasks --cluster=$CLUSTER --tasks=$TASK \
--query 'tasks[*].[taskArn, createdAt]' --output=text | \
awk -v end='2021-12-21' '{print $1}'
done
@bubeamos
bubeamos / dynamo_delete_all.py
Created November 22, 2021 18:47 — forked from Swalloow/dynamo_delete_all.py
Boto3 DynamoDB delete all items
import boto3
dynamodb = boto3.resource('dynamodb', 'region-name')
table = dynamodb.Table('table-name')
scan = table.scan(
ProjectionExpression='#k',
ExpressionAttributeNames={
'#k': 'name'
}
@bubeamos
bubeamos / k8s-svc-annotations.md
Created August 24, 2020 06:30 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@bubeamos
bubeamos / cert-manager-nginx-ingress-gke-recipe.md
Created September 19, 2019 17:37
A quickstart guide to deploying cert-manager and nginx-ingress on GKE

This is a quick recipe for deploying cert-manager and nginx-ingress on GKE to obtain SSL certificates from Lets Encrypt. Whilst this recipe is designed for Google Cloud Platform, it can easily be adapted for other cloud platforms.

We'll begin with a Kubernetes cluster, and we'll obtain authentication credentials.

gcloud container clusters get-credentials my-test-app
kubectl config current-context
kubectl get nodes
kind: Service
apiVersion: v1
metadata:
name: example-final-elb
spec:
ports:
- port: 80
targetPort: 9376
selector:
app: source-ip
kind: Service
apiVersion: v1
metadata:
name: my-mediaiq-service
spec:
ports:
- port: 8765
targetPort: 9376
selector:
app: source-ip
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-ingress-controller
spec:
replicas: 1
revisionHistoryLimit: 3
template:
metadata:
labels:
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress
spec:
type: LoadBalancer
ports:
- port: 80
name: http
- port: 443