Kubernetes monitoring using Snap
Shell Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
plugins updates kubestate collector plugin Dec 16, 2016
.gitignore Add custom built docker snap plugin Nov 8, 2016
Dockerfile
LICENSE Initial commit Sep 20, 2016
Makefile refactor startup to allow passing cmdline args to snapteld Jan 17, 2017
README.md refactor startup to allow passing cmdline args to snapteld Jan 17, 2017
snapteld.conf
start.sh refactor startup to allow passing cmdline args to snapteld Jan 17, 2017

README.md

snap_k8s

Kubernetes monitoring using Snap

Usage

This docker image is designed to deployed into Kubernets as a DaemonSet, causing it to run on every node in the cluster. For the best results, we recommend you use the Grafana kubernetes-app see - https://grafana.net/

For manual deployment the following kubernetes manifest can be used.

apiVersion: v1
kind: ConfigMap
metadata:
  name: snap-tasks
  namespace: kube-system
data:
  core.json: |-
    {
          "version": 1,
          "schedule": {
            "type": "simple",
            "interval": "10s"
          },
          "start": true,
          "workflow": {
            "collect": {
              "metrics": {
                "/intel/docker/*":{},
                "/intel/procfs/cpu/*": {},
                "/intel/procfs/meminfo/*": {},
                "/intel/procfs/iface/*": {},
                "/intel/linux/iostat/*": {},
                "/intel/procfs/load/*": {}
              },
              "config": {
                "/intel/procfs": {
                  "proc_path": "/proc_host"
                }
              },
              "process": null,
              "publish": [
                {
                  "plugin_name": "graphite",
                  "config": {
                    "prefix": "snap.CLUSTER_NAME.<%NODE%>",
                    "server": "graphite.host.name",
                    "port": 2003
                  }
                }
              ]
            }
          }
        }
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  labels:
    daemon: snapd
  name: snap
  namespace: kube-system
spec:
  template:
    metadata:
      labels:
        daemon: snapd
      name: snap
    spec:
      containers:
      - env:
        - name: PROCFS_MOUNT
          value: /proc_host
        - name: SNAP_PORT
          value: "8181"
        image: raintank/snap_k8s:latest
        imagePullPolicy: Always
        name: snap
        securityContext:
          privileged: true
        ports:
        - containerPort: 8181
          hostPort: 8181
          name: snap-api
          protocol: TCP
        volumeMounts:
        - mountPath: /sys/fs/cgroup
          name: cgroup
        - mountPath: /var/run/docker.sock
          name: docker-sock
        - mountPath: /var/lib/docker
          name: fs-stats
        - mountPath: /usr/local/bin/docker
          name: docker
        - mountPath: /proc_host
          name: proc
        - mountPath: /opt/snap/tasks
          name: snap-tasks
      hostNetwork: true
      hostPID: true
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
      - hostPath:
          path: /dev
        name: dev
      - hostPath:
          path: /sys/fs/cgroup
        name: cgroup
      - hostPath:
          path: /var/run/docker.sock
        name: docker-sock
      - hostPath:
          path: /var/lib/docker
        name: fs-stats
      - hostPath:
          path: /usr/bin/docker
        name: docker
      - hostPath:
          path: /proc
        name: proc
      - configMap:
          defaultMode: 420
          name: snap-tasks
        name: snap-tasks

Building

To build the image simply run

make

To Publish the image to docker hub

Ensure that you are logged into DockerHub

docker login

Then run push the image to your account.

make push REPO=<Your DockerHub Org>