Skip to content

Instantly share code, notes, and snippets.

‎‎​

@timoyuen
timoyuen / USING-VAULT.md
Created May 30, 2022 21:59 — forked from voxxit/USING-VAULT.md
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init

What is kubernetes ?

  • kubernetes is an open source orchestration tool for Docker containers( kubernetes supports also rkt as a replacement for docker).
  • It automates the deployment + scaling + management of Docker containers across clusters of physical or virtual machines .

How it's related to Docker (or Rkt)?

  • Docker manage the life cycle of a container (run,stop,start etc... a container), kubernetes (specifically kubelet) instructs or delegate Docker to do this task on a specific machine.

What is a cluster in kubernetes ?

  • it's the physical machines or the virtual ones that the kubernetes platform is deployed on, mainly it's composed from a master machine and nodes.

What are the componments of kubernetes?

  • Master components:
  • etcd
@timoyuen
timoyuen / README.MD
Created March 18, 2021 10:38 — forked from embano1/README.MD
Dockerfile for Go modules and built cache efficiency

Also works across git branches if you keep the intermediate build images around, e.g. those <none> images in the docker images output.

FROM golang:1.12 AS builder

# enable Go modules support
ENV GO111MODULE=on

WORKDIR $GOPATH/src/github.com/myrepo/myapp
@timoyuen
timoyuen / nginx.conf
Created March 11, 2021 03:56 — forked from morhekil/nginx.conf
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@timoyuen
timoyuen / json_to_map.go
Created December 17, 2020 06:48 — forked from cuixin/json_to_map.go
json to map[string]interface{} example in golang
package main
import (
"encoding/json"
"fmt"
)
func dumpMap(space string, m map[string]interface{}) {
for k, v := range m {
if mv, ok := v.(map[string]interface{}); ok {
@timoyuen
timoyuen / kubedump.sh
Created December 3, 2020 09:54 — forked from negz/kubedump.sh
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@timoyuen
timoyuen / gcp_manage_tf_02.sh
Created November 24, 2020 14:18 — forked from darkn3rd/gcp_manage_tf_02.sh
Manage GCP Projects 2
export TF_CREDS=~/.config/gcloud/terraform-admin.json
# create service account in Terraform Admin Project
gcloud iam service-accounts create terraform \
--display-name "Terraform Admin Account"
# download JSON credentials
gcloud iam service-accounts keys create ${TF_CREDS} \
--iam-account terraform@${TF_ADMIN}.iam.gserviceaccount.com
@timoyuen
timoyuen / gcp_manage_tf_02.sh
Created November 24, 2020 14:18 — forked from darkn3rd/gcp_manage_tf_02.sh
Manage GCP Projects 2
export TF_CREDS=~/.config/gcloud/terraform-admin.json
# create service account in Terraform Admin Project
gcloud iam service-accounts create terraform \
--display-name "Terraform Admin Account"
# download JSON credentials
gcloud iam service-accounts keys create ${TF_CREDS} \
--iam-account terraform@${TF_ADMIN}.iam.gserviceaccount.com
@timoyuen
timoyuen / .gitlab-ci.yml
Created August 19, 2020 15:36 — forked from troyharvey/.gitlab-ci.yml
Deploy Google Cloud Functions: GitLab CI/CD Pipeline Config File
variables:
GCP_ZONE: us-central1-a
stages:
- npm-install
- push
npm-install:
image: node:8-alpine
stage: npm-install