Skip to content

Instantly share code, notes, and snippets.

View dwdraju's full-sized avatar

Raju Dawadi dwdraju

View GitHub Profile
@dwdraju
dwdraju / kubectl-sa-kubeconfig.sh
Last active October 3, 2024 14:20
kubectl generate kubeconfig file for service account
#!/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 <service_account_name> <namespace>"
exit 1
fi
@dwdraju
dwdraju / kuebctl-commands.md
Last active June 24, 2018 10:12
General Kubectl Commands
  • Get pods
kubectl get pods
  • Enter into pod
kubectl exec -it [pod-name] /bin/bash
@dwdraju
dwdraju / vault-mysql-docker.md
Created June 23, 2018 09:29
hashicorp vault docker for mysql dynamic secret
vault:
  container_name: vault
  image: dtestops/vault
  volumes:
    - ./vault.hcl:/etc/vault.hcl
  links:
    - "mysql:mysql"
  ports:
 - "8200:8200"
@dwdraju
dwdraju / Microservice-Failure.md
Last active June 23, 2018 09:25
Microservice Failure
  • Dynamic environments and distributed systems - like microservices - lead to a higher chance of failures.
  • Services should fail separately, achieve graceful degradation to improve user experience.
  • 70% of the outages are caused by changes, reverting code is not a bad thing.
  • Fail fast and independently. Teams have no control over their service dependencies.
  • Architectural patterns and techniques like caching, bulkheads, circuit breakers and rate-limiters help to build reliable microservices.

@dwdraju
dwdraju / cert-check.md
Last active September 21, 2020 10:16
Check ssl cert expiration and pem file
#!/bin/bash

if [ ! -z "$DEBUG" ]; then
  set -x
  DEBUG=
fi
DOMLIST="example.com"

for D in $DOMLIST
@dwdraju
dwdraju / hubot-slack-grafana.md
Last active June 23, 2018 08:53
hubot-slack grafana screenshot
npm install -g yo generator-hubot
mkdir myhubot
cd myhubot
yo hubot
bin/hubot
Hubot&gt;
@dwdraju
dwdraju / k8s-ingress-controller.md
Last active June 23, 2018 08:42
nginx ingress controller on Kubernetes k8s
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'      
helm init --service-account tiller --upgrade
helm init
@dwdraju
dwdraju / prometheus-influxdb-storage.md
Last active September 12, 2019 08:22
prometheus influxdb storage
# Remote write configuration (for Graphite, OpenTSDB, or InfluxDB).
remote_write:
- url: "http://localhost:8086/api/v1/prom/write?u=paul&p=foo&db=prometheus"
# Remote read configuration (for InfluxDB only at the moment).
remote_read:
- url: "http://localhost:8086/api/v1/prom/read?u=paul&p=foo&db=prometheus"
@dwdraju
dwdraju / gcloud-sole-tenancy.md
Last active June 23, 2018 08:29
gcloud sole tenancy
gcloud beta compute sole-tenancy node-templates create test-tenant-node --region us-central1 --node-requirements vCPU=any,memory=any,localSSD=0


gcloud beta compute sole-tenancy node-groups create sole-tenancy-group --zone us-central1-b --node-template test-tenant-node --target-size 2


gcloud beta compute instances create my-sole-instance --zone us-central1-b     --image-family ubuntu-1604-lts --image-project ubuntu-os-cloud     --node-group sole-tenancy-group --custom-cpu 4 --custom-memory 5

gcloud beta compute sole-tenancy node-templates list
@dwdraju
dwdraju / python-https-server.md
Last active June 21, 2018 04:56
Simple Python HTTPS Server

Generate cert

openssl req -new -x509 -keyout yourpemfile.pem -out yourpemfile.pem -days 365 -nodes

Run Python Server

import BaseHTTPServer, SimpleHTTPServer
import ssl