Skip to content

Instantly share code, notes, and snippets.

@DD-ScottBeamish
Created July 25, 2018 01:38
Show Gist options
  • Save DD-ScottBeamish/c8cdae5ced99670d94d06ee75c29deed to your computer and use it in GitHub Desktop.
Save DD-ScottBeamish/c8cdae5ced99670d94d06ee75c29deed to your computer and use it in GitHub Desktop.
kind: ConfigMap
apiVersion: v1
metadata:
name: dd-agent-config
namespace: myproject
data:
kubernetes.yaml: |-
init_config:
min_collection_interval: 300
instances:
- port: 0
method: https
kubelet_tls_verify: False
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: datadog-agent
spec:
template:
metadata:
labels:
app: datadog-agent
name: datadog-agent
spec:
serviceAccountName: datadog-agent
nodeSelector:
label: local
containers:
- image: datadog/docker-dd-agent:latest
imagePullPolicy: Always
name: datadog-agent
ports:
- containerPort: 8125
name: dogstatsdport
protocol: UDP
- containerPort: 8126
name: traceport
protocol: TCP
securityContext:
privileged: true
env:
- name: DD_API_KEY
value: XXX
- name: DD_COLLECT_KUBERNETES_EVENTS
value: "true"
- name: DD_LEADER_ELECTION
value: "true"
- name: KUBERNETES
value: "yes"
- name: DD_KUBERNETES_KUBELET_HOST
valueFrom:
fieldRef:
fieldPath: spec.nodeName
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "250m"
volumeMounts:
- name: dockersocket
mountPath: /var/run/docker.sock
- name: procdir
mountPath: /host/proc
readOnly: true
- name: cgroups
mountPath: /host/sys/fs/cgroup
readOnly: true
- mountPath: /etc/dd-agent/conf.d/kubernetes.yaml.example
name: dd-agent-config
subPath: kubernetes.yaml
livenessProbe:
exec:
command:
- ./probe.sh
initialDelaySeconds: 15
periodSeconds: 5
volumes:
- hostPath:
path: /var/run/docker.sock
name: dockersocket
- hostPath:
path: /proc
name: procdir
- hostPath:
path: /sys/fs/cgroup
name: cgroups
- configMap:
name: dd-agent-config
name: dd-agent-config
#!/bin/bash
./oc cluster up --image=registry.access.redhat.com/openshift3/ose --version=v3.5
./oc login -u system:admin
# you need to run ./oc get nodes to get the ip address of your local node and use it here
./oc label node 192.168.65.3 label=local
./oc create serviceaccount datadog-agent
./oc adm policy add-scc-to-user privileged system:serviceaccount:myproject:datadog-agent
./oc create -f configmap.yaml
./oc create -f dd-agent-daemonset.yaml
@DD-ScottBeamish
Copy link
Author

DD-ScottBeamish commented Jul 25, 2018

Instructions

  1. Download the oc 1.5 client and extract 'oc' to same dir as these files.

  2. Bring a cluster up on Openshift 3.5:

    oc cluster up --image=registry.access.redhat.com/openshift3/ose --version=v3.5

  3. Login as Admin:

    oc login -u system:admin

  4. Label the node

    oc get nodes
    oc label node 192.168.65.3 label=local

  5. Create a serviceaccount

    oc create serviceaccount datadog-agent

  6. Add permissive policy to serviceaccount

    oc adm policy add-scc-to-user privileged system:serviceaccount:myproject:datadog-agent

  7. Create the config-map

    oc create -f configmap.yaml

  8. Run Daemonset (as service account, with label selector and as a privileged pod)

    oc create -f dd-agent-daemonset.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment