sltd
Tag ELB from service label in kubernetes cluster for Datadog monitoring.
Service Label to Tag by Daemon = sltd
kube_namespace
filter in Metrics Explorer
- Kubernetes with ELB requests and status in Dashboard
- Dashboard with 2XX / request_count
"q": "100 * sum:aws.elb.httpcode_backend_2xx{$pod,$replication_controller,$namespace,$cluster,$scope,$kube_name,$kube_deployment}.as_count() / sum:aws.elb.request_count{$pod,$replication_controller,$namespace,$cluster,$scope,$kube_name,$kube_deployment}.as_count()"
Table of Contents
Created by gh-md-toc
Requirements
- Kubernetes 1.3 or later
- AWS Credentials keys (need DescribeTags, AddTags, RemoveTags)
Installation
Using Homebrew (OS X only)
Formula is available at koudaiii/homebrew-tools.
$ brew tap koudaiii/tools
$ brew install sltd
Precompiled binary
Precompiled binaries for Windows, OS X, Linux are available at Releases.
From source
$ go get -d github.com/koudaiii/sltd
$ cd $GOPATH/src/github.com/koudaiii/sltd
$ make deps
$ make install
Run in a Docker container
docker image is available at quay.io/koudaiii/sltd.
# -t is required to colorize logs
$ docker run \
--rm \
-t \
-e AWS_ACCESS_KEY_ID="XXXXXXX" \
-e AWS_SECRET_ACCESS_KEY="XXXX" \
-e AWS_DEFAULT_REGION="ap-northeast-1" \
-e AWS_REGION="ap-northeast-1" \
-v $HOME/.kube/config:/.kube/config \
quay.io/koudaiii/sltd:latest \
--in-cluster=false
Usage
$ sltd --onetime
$ sltd --sync-interval=10s
kubeconfig file
if sltd
uses out of cluster, ~/.kube/config
as default.
Options
Option |
Description |
Required |
Default |
--onetime=bool |
run one time and exit. |
optional |
false |
--in-cluster=bool |
if sltd uses out of cluster,need --in-cluster=false |
optional |
true |
--sync-interval=string |
the time duration between template processing. |
optional |
60s |
-h , -help |
Print command line usage |
|
|
-v , -version |
Print version |
|
|
Development
Clone this repository and build using make
.
$ go get -d github.com/koudaiii/sltd
$ cd $GOPATH/src/github.com/koudaiii/sltd
$ make
Deployment Guide
Kubernetes
containers:
- image: "quay.io/koudaiii/sltd:latest"
name: sltd
resources:
requests:
cpu: 100m
memory: 30Mi
command:
- "/sltd"
args:
- "--sync-interval=600s"
env:
- name: AWS_DEFAULT_REGION
value: "ap-northeast-1"
- name: AWS_REGION
value: "ap-northeast-1"
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: dotenv
key: aws-access-key-id
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: dotenv
key: aws-secret-access-key
Author
@koudaiii
License