Skip to content

Instantly share code, notes, and snippets.

View gianrubio's full-sized avatar

Giancarlo Rubio gianrubio

View GitHub Profile
@gianrubio
gianrubio / icon.svg
Last active March 12, 2024 10:18
icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
{
"type": "add",
"product": "Coca-Cola",
"price": "1.25",
"user": "1a0ce7f4",
"count": 5
},
{
"type": "remove",
stages:
- deploy
deploy:
stage: deploy
script:
- mkdir .public
- ls -all
@gianrubio
gianrubio / replace-secret.sh
Created August 3, 2018 08:13
Replace tls secret on kubernetes
kubectl delete secret -n namespace hostname.com
kubectl create secret tls -n accept hostname.com --key /Volumes/Untitled/hostname.com/hostname.com.key --cert /Volumes/Untitled/hostname.com/hostname.com.pem
@gianrubio
gianrubio / gist:2012aa00fe928891fe95bdc13376e0f9
Created July 29, 2018 11:25
k8s + aws - drain and detach from ASG
kubectl drain --force --ignore-daemonsets --delete-local-data ip-10-100-45-198.eu-west-1.compute.internal
aws autoscaling detach-instances --instance-ids i-0d5a6fd4e9fbf4d47 --auto-scaling-group-name certs-2018 --should-decrement-desired-capacity
@gianrubio
gianrubio / nginx.json
Created July 27, 2018 14:57
nginx-json
log-format-upstream: '{ "time": "$time_iso8601", "remote_addr": "$proxy_protocol_addr",
"x-forward-for": "$proxy_add_x_forwarded_for", "request_id": "$req_id", "remote_user":
"$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status":
$status, "vhost": "$host", "request_proto": "$server_protocol", "path": "$uri",
"request_query": "$args", "request_length": $request_length, "duration": $request_time,
"method": "$request_method", "http_referrer": "$http_referer", "http_user_agent":
"$http_user_agent" }'
groups:
- name: beertime.rules
rules:
- alert: BEERTIME
expr: IF (day_of_week() == 5) and ( hour() >= 16 and hour() <= 16 )
for: 5m
labels:
service: "beer"
severity: "critical"
annotations:
@gianrubio
gianrubio / Values.yaml
Last active April 27, 2018 13:08
Push fluentd logs to Elasticsearch with tls termination
elasticsearch:
host: 'elasticsearch-example-es-cluster'
port: 9200
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
configMaps:
@gianrubio
gianrubio / kubernetes-curl.sh
Last active February 27, 2018 09:45
kubernetes api using curl
ETCD_HOST=my-etcd-hostnam
curl https://kubernetes.default.svc.cluster.local/apis --key worker-key.pem --cert worker.pem --cacert ca.pem --cert-type PEM
curl https://$ETCD_HOST:2379 --key etcd-client-key.pem --cert etcd-client.pem --cacert ca.pem
@gianrubio
gianrubio / nginx-pod-svc.yaml
Last active October 1, 2017 20:27
nginx-pod-svc.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: default
labels:
app: nginx
spec:
containers:
- name: nginx