Skip to content

Instantly share code, notes, and snippets.

Source range lb:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/load-balancer-source-ranges: "10.0.0.0/8"
  name: netexec
  labels:
 app: netexec
apiVersion: v1
kind: ReplicationController
metadata:
  name: gce-busybox
spec:
  replicas: 1
  selector:
    name: gce-busybox
 template:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-provisioning-test
  labels:
    test: pv-provisioning
  annotations:
    volume.alpha.kubernetes.io/storage-class: anything
spec:
apiVersion: v1
kind: Service
metadata:
  name: echoheadersx
  labels:
    app: echoheaders
spec:
  type: NodePort
  ports:
@bprashanth
bprashanth / l7_debug.md
Last active March 23, 2016 23:18
L7 debug

What's the restart count on the pod?
what's the output of

$ kubectl logs --namespace=kube-system exec l7-lb-controller-v0.5.2-apv4a -c l7-lb-controller 

If it's restarting, can you please try:

$ kubectl --namespace=kube-system exec l7-lb-controller-v0.5.2-apv4a -c l7-lb-controller -- curl --silent localhost:8080/healthz
It should return a 200 and the string "ok".

Needs bprashanth/glbc:0.6.2

Create the static ip:

$ gcloud compute addresses create staticip --global
NAME     REGION ADDRESS       STATUS
staticip        107.some.ip RESERVED

Specify the annotation (this step assumes you have a secret called testsecret and a service called haproxy):

Start 2 kubernetes clusters.

Pick 1 node and label it as role=loadbalancer:

$ kubectl get nodes
NAME                              STATUS    AGE
gke-failover-c93a5565-node-bilp   Ready     1h
gke-failover-c93a5565-node-siro   Ready     1h
gke-failover-c93a5565-node-woat   Ready     1h
@bprashanth
bprashanth / https-sticky.md
Last active February 19, 2018 18:54
https sticky sessions

Create a backend service that simply serves the pod name, and a frontend haproxy instance that balances based on client cookies.

# This is the backend service
apiVersion: v1
kind: Service
metadata:
  name: hostname
  annotations:
    # Enable sticky-ness on "SERVERID"
    serviceloadbalancer/lb.cookie-sticky-session: "true"
@bprashanth
bprashanth / stickysessions.md
Last active July 29, 2016 21:30
sticky sessions

Create a backend service that simply serves the pod name, and a frontend haproxy instance that balances based on client cookies.

# This is the backend service
apiVersion: v1
kind: Service
metadata:
  name: hostname
  annotations:
    # Enable sticky-ness on "SERVERID"
    serviceloadbalancer/lb.cookie-sticky-session: "true"
$ sudo cat /lib/systemd/system/test.service 
[Unit]
Description=test

[Service]
WatchdogSec=5s
ExecStart=/tmp/test
Restart=always