Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
# Usage ./k8s-service-account-kubeconfig.sh ( namespace ) ( service account name )
TEMPDIR=$( mktemp -d )
trap "{ rm -rf $TEMPDIR ; exit 255; }" EXIT
SA_SECRET=$( kubectl get sa -n $1 $2 -o jsonpath='{.secrets[0].name}' )
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: ingressgateway
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- dns1
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
annotations:
name: ingressgateway
spec:
selector:
istio: ingressgateway
servers:
- hosts:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: es-test
spec:
version: 7.5.1
nodeSets:
- name: es-test
count: 3
config:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: es-prod
spec:
version: 7.6.0
nodeSets:
- name: es-prod
count: 3
config:
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: startup-script
labels:
app: startup-script
spec:
template:
metadata:
labels:
@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
@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
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
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
replicas: 21
selector: