Skip to content

Commit aacbb36

Browse files
committed
Helm chart for pcm - initial version
1 parent 6ef66c4 commit aacbb36

24 files changed

+1047
-13
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ latex/
3232
.vs/
3333
.idea/
3434
build
35-
src/simdjson
35+
src/simdjson
36+
/deployment/pcm/smarter-device-manager/
37+
/deployment/pcm/nri/

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ FROM fedora:40@sha256:4e007f288dce23966216be81ef62ba05d139b9338f327c1d1c73b7167d
22

33
RUN dnf -y install gcc-c++ git findutils make cmake
44
COPY . /tmp/pcm
5-
RUN cd /tmp/pcm && mkdir build && cd build && cmake .. && make
5+
# TEMPORARY change to be remove before merge, to not conflict with local builds + use cache
6+
# WARNING this approach requires me to build locally before docker build to get updated
7+
RUN --mount=type=cache,target=/tmp/pcm/build2 cd /tmp/pcm && cd build2 && cmake -D CMAKE_BUILD_TYPE=Debug .. && make -j pcm pcm-sensor-server
68

79
FROM fedora:40@sha256:4e007f288dce23966216be81ef62ba05d139b9338f327c1d1c73b7167dd47312
10+
RUN yum install -y strace gdb util-linux
811
COPY --from=builder /tmp/pcm/build/bin/* /usr/local/bin/
912
ENV PCM_NO_PERF=1
1013

KUBERNETES.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
##### Create kind based development cluster
2+
3+
```sh
4+
kind create cluster
5+
kind export kubeconfig
6+
```
7+
8+
##### 1) Install Prometheus operator required for PodMonitor CRD
9+
10+
E.g. use prometheus operator helm chart from here: https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
11+
12+
https://prometheus-operator.dev/docs/operator/design/#podmonitor
13+
14+
```sh
15+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
16+
17+
helm repo update
18+
helm repo list
19+
20+
# check prometheus source if needed
21+
helm pull prometheus-community/kube-prometheus-stack
22+
tar -xzvf kube-prometheus-stack-56.6.2.tgz
23+
24+
# show/customize values e.g. pod monitor namespace selector
25+
helm show values prometheus-community/kube-prometheus-stack
26+
helm show values prometheus-community/kube-prometheus-stack | vim - +'set ft=yaml'
27+
helm template prometheus-community/kube-prometheus-stack --set-json prometheus.prometheusSpec.podMonitorNamespaceSelector='{"matchLabels": {"kubernetes.io/metadata.name": "intel-pcm"}}' | vim - +'set ft=yaml'
28+
29+
# Install
30+
helm install prometheus prometheus-community/kube-prometheus-stack --set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false
31+
32+
helm list
33+
34+
kubectl --namespace default get pods -l "release=prometheus"
35+
```
36+
37+
To remove:
38+
```sh
39+
helm uninstall prometheus
40+
helm repo remove prometheus-community
41+
```
42+
43+
##### 2) Deploy PCM daemonset
44+
45+
```sh
46+
kubectl apply -f pcm-kubernetes.yaml
47+
48+
# and verify ...
49+
kubectl -n intel-pcm get daemonset
50+
kubectl -n intel-pcm get pods
51+
podname=`kubectl -n intel-pcm get pods -ojsonpath='{.items[0].metadata.name}'`
52+
```
53+
54+
##### 3) Verirfy PCM metrics are collected by Prometheus
55+
56+
```sh
57+
kubectl proxy &
58+
```
59+
60+
Access PCM metrics directly:
61+
```sh
62+
curl -Ls http://127.0.0.1:8001/api/v1/namespaces/intel-pcm/pods/$podname/proxy/metrics
63+
curl -Ls http://127.0.0.1:8001/api/v1/namespaces/intel-pcm/pods/$podname/proxy/metrics | grep DRAM_Writes
64+
```
65+
66+
or through Prometheus UI:
67+
```
68+
http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy/graph
69+
promtool query range --step 1m http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy 'rate(DRAM_Writes{aggregate="system"}[5m])/1e9'
70+
promtool query instant http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy 'avg by(__name__) ({job="pcm"})'
71+
```
72+
73+
query metrics via promtool
74+
```sh
75+
promtool query range --step 1m http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy 'rate(DRAM_Writes{aggregate="system"}[5m])/1e9'
76+
promtool query instant http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy 'avg by(__name__) ({job="pcm"})'
77+
```
78+
79+
run some workloads:
80+
```sh
81+
kubectl run -ti stress --image=alexeiled/stress-ng --restart=Never --rm -- --stream 8
82+
```
83+
84+
85+
##### Uninstall PCM
86+
87+
```sh
88+
kubectl delete -f pcm-kubernetes.yaml
89+
```
90+
91+
92+

deployment/pcm/.helmignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
smarter-device-manager/
25+
nri/

deployment/pcm/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
name: pcm
3+
version: 0.1.0
4+
appVersion: "202403"
5+
description: A PCM Helm chart for Kubernetes
6+
home: https://github.com/intel/pcm
7+
maintainers:
8+
- name: Pawel Palucki
9+

deployment/pcm/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2009-2023, Intel Corporation
4+
Copyright (c) 2016-2020, opcm
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
* Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)