Skip to content

Instantly share code, notes, and snippets.

@lukaszbudnik
lukaszbudnik / index.js
Created October 29, 2021 08:08
Kinesis Firehose Data Transformation Lambda
const redact = function (str) {
return str[0] + "*".repeat(str.length - 2) + str.slice(-1);
}
const transform = (data) => {
// decode Kinesis Data Firehose raw data and convert it to JSON object
var parsedData = JSON.parse(new Buffer.from(data,'base64').toString('utf8'));
// you can now transform the JSON object
@lukaszbudnik
lukaszbudnik / keycloak_create_realm_and_client.sh
Last active February 10, 2024 21:28
youtube.com - Keycloak Multi-Tenant JavaScript Clients
# don't forget to update below variables to point to your Keycloak instance, main realm, and admin user
export KEYCLOAK_URL="http://localhost:8080"
export KEYCLOAK_MAIN_REALM=master
export KEYCLOAK_USER=lb
export KEYCLOAK_PASSWORD=***
# get the access token
access_token=$(curl --silent \
-d "client_id=admin-cli" \
-d "username=$KEYCLOAK_USER" \
@lukaszbudnik
lukaszbudnik / create-configmap.sh
Last active May 20, 2021 12:00
dev.to - config
kubectl create configmap haproxy-auth-gateway-cfg --from-file=config/haproxy.cfg
@lukaszbudnik
lukaszbudnik / kubernetes-external-secrets on Fargate with IRSA
Created June 25, 2020 13:06
Setup godaddy/kubernetes-external-secrets on Fargate with IRSA
AWS_REGION=us-east-2
CLUSTER_NAME=lukaszbudniktest1
eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION --version 1.16 --fargate
eksctl utils associate-iam-oidc-provider --region $AWS_REGION --cluster $CLUSTER_NAME --approve
# below lines for setting up policy, role, and trust relationship are based on: https://github.com/godaddy/kubernetes-external-secrets/issues/383
EKS_CLUSTER=$CLUSTER_NAME
IAM_ROLE_NAME=eksctl-$EKS_CLUSTER-iamserviceaccount-role
@lukaszbudnik
lukaszbudnik / AWS EKS - RBAC and IAM
Created June 23, 2020 10:13
Shows how to integrate AWS IAM users/roles with Kubernetes RBAC
# eksctl version
eksctl version
0.20.0
# kubectl/Kubernetes version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.8-eks-e16311", GitCommit:"e163110a04dcb2f39c3325af96d019b4925419eb", GitTreeState:"clean", BuildDate:"2020-03-27T22:37:12Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
CLUSTER_NAME=lukaszbudniktest1
AWS_REGION=us-east-2
@lukaszbudnik
lukaszbudnik / Minikube - RBAC
Created June 23, 2020 10:05
Shows how to setup RBAC on Minikube
# minikube version
minikube version
minikube version: v1.11.0
commit: 57e2f55f47effe9ce396cea42a1e0eb4f611ebbd
# Kubernetes version
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
@lukaszbudnik
lukaszbudnik / Minikube - CloneSet
Created June 18, 2020 07:48
Shows how to scale in Kubernetes apps in a deterministic and controlled way by specifying which pods to delete.
# minikube version
minikube version
minikube version: v1.11.0
commit: 57e2f55f47effe9ce396cea42a1e0eb4f611ebbd
# Kubernetes version
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
@lukaszbudnik
lukaszbudnik / Minikube - Prometheus
Created June 18, 2020 06:14
Shows how to setup Prometheus on minikube
# minikube version
minikube version
minikube version: v1.11.0
commit: 57e2f55f47effe9ce396cea42a1e0eb4f611ebbd
# Kubernetes version
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
@lukaszbudnik
lukaszbudnik / AWS EKS - Fargate Autoscaler
Created June 9, 2020 06:32
Shows AWS EKS Fargate auto scaling.
# eksctl version
eksctl version
0.20.0
# kubectl/Kubernetes version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T14:51:23Z", GoVersion:"go1.14.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.8-eks-e16311", GitCommit:"e163110a04dcb2f39c3325af96d019b4925419eb", GitTreeState:"clean", BuildDate:"2020-03-27T22:37:12Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
AWS_REGION=us-east-2
CLUSTER_NAME=lukaszbudniktest1
@lukaszbudnik
lukaszbudnik / Azure AKS - Autoscaler
Created June 6, 2020 06:23
Shows how to setup Azure AKS cluster with autoscaler enabled.
# az version
az version
{
"azure-cli": "2.5.1",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.5.1",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}