Skip to content

Commit

Permalink
Add Dockerfile and Kubernetes DaemonSet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
pmundt committed Nov 17, 2020
1 parent 2b0ef71 commit 6e91455
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM acceleratorbase/openvino-base

ADD . /app/
WORKDIR /app
RUN python3 setup.py install

EXPOSE 8084

CMD [ "prometheus_ncs2_exporter" ]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# Intel NCS2 Prometheus Exporter

[![PyPI](https://img.shields.io/pypi/v/prometheus-ncs2-exporter.svg)](https://pypi.python.org/pypi/prometheus-ncs2-exporter)
[![PyPI](https://img.shields.io/pypi/pyversions/prometheus-ncs2-exporter.svg)](https://pypi.python.org/pypi/prometheus-ncs2-exporter)
[![Docker Pulls](https://img.shields.io/docker/pulls/adaptant/prometheus-ncs2-exporter.svg)](https://hub.docker.com/repository/docker/adaptant/prometheus-ncs2-exporter)

A Prometheus exporter for the Intel Neural Compute Stick 2 (NCS2) / Intel Movidius MyriadX

## Quick Start

To directly install `prometheus_ncs2_exporter` as a `DaemonSet` into the Kubernetes cluster:

```
$ kubectl apply -f https://raw.githubusercontent.com/adaptant-labs/prometheus_ncs2_exporter/prometheus-ncs2-exporter.yaml
```

Pods will be scheduled on any node with a `feature.node.kubernetes.io/usb-ff_03e7_2485.present` (provided by [NFD]) or
`accelerators/ncs2` (provided by [k8s-auto-labeller], in combination with NFD-based discovery) label set. These labels
can also be set manually on NCS2-capable nodes for simple deployments in order to enqueue the Pod.

[NFD]: https://github.com/kubernetes-sigs/node-feature-discovery
[k8s-auto-labeller]: https://github.com/adaptant-labs/k8s-auto-labeller

## Usage

`prometheus_ncs2_exporter` can be run as-is without any additional configuration. A number of configuration and
Expand Down
35 changes: 35 additions & 0 deletions prometheus-ncs2-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ncs2-exporter
namespace: kube-system
spec:
selector:
matchLabels:
name: ncs2-exporter
template:
metadata:
labels:
name: ncs2-exporter
annotations:
prometheus.io/scrape: "true"
spec:
containers:
- name: ncs2-exporter
image: adaptant/prometheus-ncs2-exporter:latest
ports:
- containerPort: 8084
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
# k8s-auto-labeller
- key: accelerators/ncs2
operator: Exists
- matchExpressions:
# USB-attached NCS2 (using NFD discovery)
- key: feature.node.kubernetes.io/usb-ff_03e7_2485.present
operator: In
values:
- "true"
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='prometheus_ncs2_exporter',
version='0.0.1',
version='0.1.0',
packages=['prometheus_ncs2_exporter'],
url='https://github.com/adaptant-labs/prometheus_ncs2_exporter',
license='Apache 2.0',
Expand All @@ -17,12 +17,16 @@
description='Prometheus Exporter for Intel NCS2 Metrics',
long_description=long_description,
long_description_content_type='text/markdown',
keywords=['prometheus', 'movidius', 'ncs2', 'myriadx', 'monitoring', 'exporter'],
keywords=['prometheus', 'movidius', 'ncs2', 'myriad', 'myriadx', 'monitoring', 'exporter'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: System :: Hardware',
'Topic :: System :: Monitoring',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: Apache Software License',
],
install_requires=requirements,
Expand Down

0 comments on commit 6e91455

Please sign in to comment.