Skip to content

Instantly share code, notes, and snippets.

package main
import (
"errors"
"flag"
"fmt"
"strings"
"time"
)
@kmassada
kmassada / fanout-ingress.yml
Last active October 29, 2018 01:37
Try out fanout ingress service service in GKE
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoheaders
spec:
selector:
matchLabels:
app: echoheaders
replicas: 1
template:
@kmassada
kmassada / README.md
Last active September 26, 2018 18:29
fanout ingress with static IP

create static IP

gcloud compute addresses create fanout-ingress --region $REGION

Note annotation "fanout-gress" is the name of static IP

 annotations:
@kmassada
kmassada / README.md
Created June 25, 2018 17:32
Trying let'sencrypt with nginx

Letsencrypt + nginx

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo apt-get install nginx
@kmassada
kmassada / scrape-cos-gke-logs.sh
Last active May 11, 2018 17:40
scrape CoS nodes running GKE for node logs
#!/bin/bash
# GENERIC
# uptime
# dmesg
# df -a --inodes
# cat /proc/sys/fs/file-nr
# systemctl status -l docker
# sudo journalctl -u docker
# sudo journalctl -u kube-docker-monitor.service

Create the sertificate and a secret

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout secret.key -out secret.crt -subj "/CN=foobar.com"
kubectl create secret tls tls-secret --key=secret.key --cert=secret.crt
@kmassada
kmassada / centos7-lamp-bootstrap
Last active March 7, 2018 21:02
centos7 LAMP bootstrap [vagrant]
#!/usr/bin/env bash
# centos7-mamp-bootstrap.sh
# this is an end to end LAMP setup on Centos7.
# this was originally written for Bootsrap.sh on Vagrant
#DATABASE_PW: root password to you db
DATABASE_PW=''
#DOMAIN: name of domain, used for ServerName in Apache
@kmassada
kmassada / echo.go
Last active February 27, 2018 00:46
go echoheaders
package main
import (
"fmt"
"net/http"
"strings"
"time"
)
// handler hello world, the web server
@kmassada
kmassada / README.md
Last active February 8, 2018 12:22
My GHOST BLOG workflow

STRUCTURE

  • we try out best to separate ghost/ from our application
  • depending on prod/dev ghost/ is git, or latest zip
  • Prod is started using pm2.
.
├── Capfile                        #cap task management