Skip to content

Instantly share code, notes, and snippets.

View pydevops's full-sized avatar
🏠
Working from home

Victor Yang pydevops

🏠
Working from home
View GitHub Profile
##########################################
# Helmfile #
# How to manage Kubernetes Helm releases #
# https://youtu.be/qIJt8Iq8Zb0 #
##########################################
# Referenced videos:
# - K3d - How to run Kubernetes cluster locally using Rancher k3s: https://youtu.be/mCesuGk-Fks
#########
@mikesparr
mikesparr / https-gke-neg-example.sh
Last active April 17, 2021 23:31
Example HTTPS load balancer in front of GKE cluster using NEGs
#!/usr/bin/env bash
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
export IDNS=${PROJECT_ID}.svc.id.goog # workflow identity domain
export GCP_REGION="us-west1"
export GKE_CLUSTER_NAME="west-v116"
@easel
easel / multipass.sh
Last active January 17, 2023 14:55
MultiPass Multi-Network Commands
# Create networks using Hyper-V virtual switches with "External" access
# Verify network visibility with networks command
multipass networks
# Create primary instance with two bridged networks and lots of resources
multipass launch --network name="Ethernet" --network name="WiFi" --name primary --cpus 8 --mem 40g --disk 100g
# Set the ubuntu password so remote ssh works
multipass exec primary sudo passwd ubuntu
@mikesparr
mikesparr / istio-gke-tls-example.sh
Last active December 9, 2021 16:16
Example GKE ingress with TLS certificate for secure traffic to backend Istio ingress gateway
#!/usr/bin/env bash
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
export IDNS=${PROJECT_ID}.svc.id.goog # workflow identity domain
export GCP_REGION="us-west1"
export ISTIO_VERSION="1.9.1"
@israel-hdez
israel-hdez / install-splitted-bookinfo.bash
Last active November 3, 2023 20:01
Istio multi-cluster development setup
#!/bin/bash
set -e
: ${ISTIO_DIR:="$HOME/apps/istio-1.9.0"}
ISTIOCTL=$ISTIO_DIR/bin/istioctl
: ${BOOKINFO_NS:=bookinfo}
: ${CTX1:=kukulcan}
@djjudas21
djjudas21 / README.md
Created December 30, 2020 15:14
MicroK8s, Ingress and MetalLB

Ingress MetalLB

Out of the box, the MicroK8s distribution of ingress-nginx installed as the MicroK8s addon ingress binds to ports 80+443 on the node's IP address using a hostPort, as we can see here:

microk8s kubectl -n ingress describe daemonset.apps/nginx-ingress-microk8s-controller
Name:           nginx-ingress-microk8s-controller
Selector:       name=nginx-ingress-microk8s
@mikesparr
mikesparr / ingress-multi-backend-demo.sh
Created December 11, 2020 01:11
Kubernetes Ingress with multiple backends and wildcard defaults
#!/usr/bin/env bash
#!/usr/bin/env bash
# ref: https://cloud.google.com/config-connector/docs/how-to/getting-started
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
export IDNS=${PROJECT_ID}.svc.id.goog # workload identity domain
@mikesparr
mikesparr / bastion_iap_setup.sh
Last active May 16, 2023 14:51
Google Cloud bastion jump host with Cloud IAP tunneling over private network example
#!/usr/bin/env bash
# set vars
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
export IDNS=${PROJECT_ID}.svc.id.goog # workflow identity domain
export REGION="us-central1"
export ZONE="us-central1-a"
@anchitarnav
anchitarnav / create_setup_short_lived.sh
Last active December 12, 2020 22:51
Creating and using Short Lived Credentials in GCP
#!/bin/bash
# Sets env variable GOOGLE_CLOUD_PROJECT if not present
[[ -z "${GOOGLE_CLOUD_PROJECT}" ]] && read -p "Enter Project ID : " GOOGLE_CLOUD_PROJECT
gcloud config set project $GOOGLE_CLOUD_PROJECT
# Creating the service accounts
gcloud iam service-accounts create sa-2-high
gcloud iam service-accounts create sa-1-low
@mikesparr
mikesparr / main.tf
Last active March 9, 2023 11:34
Terraform GCP Secure Example (Infra)
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.37"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.37"
}