Skip to content

Instantly share code, notes, and snippets.

View dhananjaipai's full-sized avatar

Dhananjai Pai dhananjaipai

View GitHub Profile
// ==UserScript==
// @name DevTools Android
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Use Eruda to enable devTools for Android
// @author dhananjaipai
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
## Goto Azure portal
##### > resource groups [rg-private-aks-demo, if you followed the blog]
##### > Virtual Machine [vm-bastion]
##### > Click on "Bastion" on the left-hand pane
##### > Enter the bastion_admin username and password you set in your .tfvars and Login
##### > Allow clipboard access to the new tab that opens a cloud shell to our VM
## Enter the Service Principal credentials
#### and run following commands to test whether the setup works,
#### and to access the AKS cluster
##
# Configure the Azure Provider
##
provider "azurerm" {
version = "=2.8.0"
features {}
}
##
# Define variables for location, service principal for AKS and Bastion VM Admin
## Pass the secret name as argument
## Example usage to restart all pods: ./FindDependentPods.sh postgres-credentials | xargs -n1 kubectl delete pod
SECRET_NAME=$1
# The code below finds all pods that depend on a specific secret for environment variables or volume mounts
containerEnvFrom=$(kubectl get pods \
-o jsonpath='{range .items[*]}{.metadata.name}{" |"}{.spec.containers[*].envFrom[*].secretRef.name}{"\n"}' \
| grep -w "|${SECRET_NAME}" \
| awk 'BEGIN { FS="|" }{ print $1 }')
containerEnvValueFrom=$(kubectl get pods \
# Set the right K8s context
kubectl config use-context <some_context>
# Delete old secret
kubectl delete secret postgres-credentials
# Create new secret
kubectl create secret generic postgres-credentials \
--from-literal=DB_HOST=<new_host> \
--from-literal=DB_PORT=5432 \