Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
set -x
ID=`az account show --query id -o json`
SUBSCRIPTION_ID=`echo $ID | tr -d '"' `
TENANT=`az account show --query tenantId -o json`
TENANT_ID=`echo $TENANT | tr -d '"' | base64`
read -p "What's your cluster name? " cluster_name
read -p "Resource group name? " resource_group
bash cluster-autoscaler.sh
Output:
---
apiVersion: v1
data:
ClientID: <base64 encoded>
ClientSecret: <base64 encoded>
ResourceGroup: <base64 encoded>
SubscriptionID: <base64 encoded>
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-addon: cluster-autoscaler.addons.k8s.io
k8s-app: cluster-autoscaler
name: cluster-autoscaler
namespace: kube-system
---
az aks create --resource-group <resource-group> --name <cluster-name> --kubernetes-version 1.12.4 \
--node-count 1 --node-vm-size Standard_DS1_v2 \
--vnet-subnet-id "/subscriptions/xxxx-xxxx-xxxxxxxxxxx/resourceGroups/xxxxxx/providers/Microsoft.Network/virtualNetworks/k8s-vnet/subnets/k8s-nodes-subnet" \
--network-plugin azure \
--service-cidr 10.20.0.0/16 --dns-service-ip 10.20.0.10 \
--enable-cluster-autoscaler \
--min-count 1 \
--max-count 3
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
replicas: 21
selector:
helm template install/kubernetes/helm/istio --name istio --namespace istio-system --set global.proxy.includeIPRanges="10.0.0/16"> ~/workspace/istio/istio.yaml
You can add more options on --set key=value with comma seperated
Eg:
helm template install/kubernetes/helm/istio --name istio --namespace istio-system --set global.proxy.includeIPRanges="10.0.0.0/16",global.mtls.enabled=false,grafana.enabled=true,kiali.enabled=true,tracing.enabled=true > ~/workspace/istio/istio.yaml
@anoopl
anoopl / kafka-generate-ssl3.sh
Created August 5, 2019 13:32
Create Kafka JKS Keys
#!/bin/bash
#Step 1
#Generate server keystore and client keystore
keytool -keystore kafka.server.keystore.jks -alias localhost -validity 365 -genkey
keytool -keystore kafka.client.keystore.jks -alias localhost -validity 365 -genkey
#Step 2
#Create CA
openssl req -new -x509 -keyout ca-key -out ca-cert -days 365
#Add generated CA to the trust store
keytool -keystore kafka.server.truststore.jks -alias CARoot -import -file ca-cert
@anoopl
anoopl / create-kubeconfig-file.sh
Last active February 23, 2020 12:21
service-account-spinnaker
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 onboarding-dev-deploy onboarding"
exit 1
fi
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: startup-script
labels:
app: startup-script
spec:
template:
metadata:
labels:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: es-prod
spec:
version: 7.6.0
nodeSets:
- name: es-prod
count: 3
config: