Skip to content

Instantly share code, notes, and snippets.

View richardsonlima's full-sized avatar
:octocat:
Focusing

Richardson Lima richardsonlima

:octocat:
Focusing
View GitHub Profile
@richardsonlima
richardsonlima / a-k8s-cluster-on-DO-with-ansible.sh
Last active July 10, 2018 03:07
digitalocean-kubernetes-1-10-cluster-using-kubeadm-on-ubuntu-16-04
brew upgrade ansible
mkdir -p /Users/richardsonlima/k8s-digitalocean-ansible/kube-cluster
ssh-add ~/.ssh/id_rsa # avoiding ssh key phrase dialog
ansible-playbook -i hosts ~/k8s-digitalocean-ansible/kube-cluster/initial.yml
ansible-playbook -i hosts ~/k8s-digitalocean-ansible/kube-cluster/kube-dependencies.yml
ansible-playbook -i hosts ~/k8s-digitalocean-ansible/kube-cluster/master.yml
ansible-playbook -i hosts ~/k8s-digitalocean-ansible/kube-cluster/workers.yml
kubectl get nodes
kubectl get po --all-namespaces
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.6.2/manifests/metallb.yaml
package main
import (
"crypto/tls"
"github.com/gorilla/mux"
"github.com/justinas/alice"
"golang.org/x/crypto/acme/autocert"
"log"
"net/http"
"time"
@richardsonlima
richardsonlima / main.go
Created July 5, 2018 04:36 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@richardsonlima
richardsonlima / Dockerfile
Created July 5, 2018 02:08
Go Dockerfile sample to k8s meetup
FROM golang:1.9-alpine
WORKDIR /opt/
COPY . .
RUN go version
RUN go build ./webserver-fs.go
package main
import (
"log"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("business"))
http.Handle("/", fs)
version: '2'
services:
mysql:
container_name: mysql
image: mysql:latest
restart: always
environment:
- MYSQL_ROOT_PASSWORD=PASSWORD-HERE
ports:
apiVersion: v1
kind: Service
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
ports:
- port: 3306
selector:
apiVersion: v1
kind: Service
metadata:
name: wordpress
labels:
app: wordpress
spec:
ports:
- port: 80
selector: