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()"
Created by gh-md-toc
- Kubernetes 1.3 or later
- AWS Credentials keys (need DescribeTags, AddTags, RemoveTags)
Formula is available at koudaiii/homebrew-tools.
$ brew tap koudaiii/tools
$ brew install sltd
Precompiled binaries for Windows, OS X, Linux are available at Releases.
$ go get -d github.com/koudaiii/sltd
$ cd $GOPATH/src/github.com/koudaiii/sltd
$ make deps
$ make install
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
-
sltd
make tag ELB from labels in kubernetes cluster.- cluster name is
kubernetescluster
key - namespace is
kube_namespace
key - service name is
kube_name
key
- cluster name is
-
--onetime
option
$ sltd --onetime
--sync-interval
option
$ sltd --sync-interval=10s
if sltd
uses out of cluster, ~/.kube/config
as default.
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 |
Clone this repository and build using make
.
$ go get -d github.com/koudaiii/sltd
$ cd $GOPATH/src/github.com/koudaiii/sltd
$ make
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