Skip to content

Instantly share code, notes, and snippets.

@conorbranagan
Last active November 8, 2018 14:44
Show Gist options
  • Save conorbranagan/3571fe9bbae55b6f557ee90c91fd873d to your computer and use it in GitHub Desktop.
Save conorbranagan/3571fe9bbae55b6f557ee90c91fd873d to your computer and use it in GitHub Desktop.

Simple Veneur / Kubernetes Setup

This walks through standing up a simple Veneur setup in Kubernetes. It will emit a simple global counter (my.global.counter) that should only have the host tag from the global instance.

Setup

  1. Create your API key as a secret.

    • Find the API key on the settings page

    • Create the secret in Kubernetes

      $ echo -n 'datadog_api_key' > /tmp/dd_name
      $ echo -n YOUR_API_KEY_HERE > /tmp/dd_api_key
      $ kubectl create secret generic datadog --from-file=/tmp/dd_name --from-file=/tmp/dd_api_key
      
  2. Apply configs to Kubernetes

    # Create the RBAC to allow access to Pod list for discovery
    $ kubectl apply -f veneur-rbac.yaml
    # Run the global veneur sevice
    $ kubectl apply -f veneur-global.yaml
    # Run the proxy veneur service
    $ kubectl apply -f veneur-proxy.yaml
    # Run an emitter that creates a metric
    $ kubectl apply -f veneur-emit.yaml
    
  3. Shortly you should see your metric appear in Datadog

    screen shot 2018-11-08 at 9 42 48am
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: veneur-emit
labels:
app: veneur-emit
spec:
minReadySeconds: 10
replicas: 1
template:
metadata:
labels:
app: veneur-emit
spec:
terminationGracePeriodSeconds: 30
containers:
- name: veneur-emit
image: index.docker.io/stripe/veneur:8.0.0
imagePullPolicy: Always
command: ["/bin/sh"]
args: ["-c", "while true; do veneur-emit -hostport udp://localhost:8126 -name 'my.global.counter' -count 1 -debug -tag 'veneurglobalonly'; sleep 10; done"]
- name: veneur
image: index.docker.io/stripe/veneur:8.0.0
ports:
- containerPort: 8126
protocol: UDP
name: stastd-listen
- containerPort: 8127
protocol: TCP
name: http
env:
- name: VENEUR_FORWARDADDRESS
value: "http://veneur-proxy:8127"
- name: VENEUR_HTTPADDRESS
value: "0.0.0.0:8127"
- name: VENEUR_NUMWORKERS
value: "3"
- name: VENEUR_DATADOGTRACEAPIADDRESS
value: ""
- name: VENEUR_SPLUNKHECADDRESS
value: ""
- name: VENEUR_SPLUNKHECTOKEN
value: ""
- name: VENEUR_SIGNALFXAPIKEY
value: ""
- name: VENEUR_FALCONERADDRESS
value: ""
- name: VENEUR_DEBUG
value: "true"
- name: VENEUR_DEBUGFLUSHEDMETRICS
value: "true"
- name: VENEUR_DATADOGAPIKEY
valueFrom:
secretKeyRef:
name: datadog
key: datadog_api_key
apiVersion: v1
kind: Service
metadata:
labels:
app: veneur-global
name: veneur-global
spec:
ports:
- name: statsd-listen
port: 8126
protocol: UDP
targetPort: 8126
- name: http
port: 8127
protocol: TCP
targetPort: 8127
selector:
app: veneur-global
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: veneur-global
labels:
app: veneur-global
spec:
minReadySeconds: 10
replicas: 1
template:
metadata:
labels:
app: veneur-global
spec:
terminationGracePeriodSeconds: 30
containers:
- name: veneur
image: index.docker.io/stripe/veneur:8.0.0
ports:
- containerPort: 8126
protocol: UDP
name: stastd-listen
- containerPort: 8127
protocol: TCP
name: http
env:
- name: VENEUR_HTTPADDRESS
value: "0.0.0.0:8127"
- name: VENEUR_NUMWORKERS
value: "3"
- name: VENEUR_DATADOGTRACEAPIADDRESS
value: ""
- name: VENEUR_SPLUNKHECADDRESS
value: ""
- name: VENEUR_SPLUNKHECTOKEN
value: ""
- name: VENEUR_SIGNALFXAPIKEY
value: ""
- name: VENEUR_FALCONERADDRESS
value: ""
- name: VENEUR_TAGS
value: "reachedglobal:true"
- name: VENEUR_DEBUG
value: "true"
- name: VENEUR_DEBUGFLUSHEDMETRICS
value: "true"
- name: VENEUR_DATADOGAPIKEY
valueFrom:
secretKeyRef:
name: datadog
key: datadog_api_key
apiVersion: v1
kind: Service
metadata:
labels:
app: veneur-proxy
name: veneur-proxy
spec:
ports:
- name: statsd-listen
port: 8126
protocol: UDP
targetPort: 8126
- name: http
port: 8127
protocol: TCP
targetPort: 8127
selector:
app: veneur-proxy
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: veneur-proxy
labels:
app: veneur-proxy
spec:
minReadySeconds: 10
replicas: 1
template:
metadata:
labels:
app: veneur-proxy
spec:
containers:
- name: veneur-proxy
image: index.docker.io/stripe/veneur:8.0.0
imagePullPolicy: Always
ports:
- containerPort: 8127
protocol: TCP
livenessProbe:
httpGet:
path: /healthcheck
port: 8127
command: ["veneur-proxy"]
args: ["-f", "/veneur/config_proxy.yaml"]
env:
- name: VENEUR_PROXY_HTTPADDRESS
value: "0.0.0.0:8127"
- name: VENEUR_PROXY_DEBUG
value: "true"
- name: VENEUR_PROXY_FORWARDADDRESS
value: "http://veneur-global:8127"
- name: VENEUR_PROXY_FORWARDSERVICENAME
value: "veneur-global"
- name: VENEUR_PROXY_STATSADDRESS
value: "127.0.0.1:8126"
# Disable consul
- name: VENEUR_PROXY_CONSULFORWARDSERVICENAME
value: "foo"
- name: VENEUR_PROXY_CONSULTRACESERVICENAME
value: ""
- name: VENEUR_PROXY_CONSULFORWARDGRPCSERVICENAME
value: ""
- name: VENEUR_PROXY_CONSULREFRESHINTERVAL
value: "30s"
# Simple and dumb RBAC
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: fabric8-rbac
subjects:
- kind: ServiceAccount
# Reference to upper's `metadata.name`
name: default
# Reference to upper's `metadata.namespace`
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment