Skip to content

Commit 22054ad

Browse files
committed
init power manager
1 parent d08c1d5 commit 22054ad

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

scripts/power_manager/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# K8s Power Manager
2+
3+
## Components
4+
1. **PowerManager Controller**: ensures the actual state matches the desired state of the cluster.
5+
2. **PowerConfig Controller**: sees the powerConfig created by user and deploys Power Node Agents onto each node specified using a DaemonSet.
6+
- powerNodeSelector: A key/value map used to define a list of node labels that a node must satisfy for the operator’s node
7+
agent to be deployed.
8+
- powerProfiles: The list of PowerProfiles that the user wants available on the nodes
9+
3. **Power Node Agent**: containerized applications used to communicate with the node’s Kubelet PodResources endpoint to discover the exact CPUs that
10+
are allocated per container and tune frequency of the cores as requested
11+
12+
13+
## Setup
14+
### 1. Manual
15+
16+
Execute the following below **as a non-root user with sudo rights** using **bash**:
17+
1. Run the node setup script:
18+
```bash
19+
git clone -b power_manager --depth=1 https://github.com/vhive-serverless/vhive.git
20+
./scripts/power_manager/setup_poer_manager.sh;
21+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: "power.intel.com/v1"
2+
kind: PowerConfig
3+
metadata:
4+
name: power-config
5+
spec:
6+
# Add labels here for the Nodes you want the PowerNodeAgent to be applied to
7+
powerNodeSelector:
8+
feature.node.kubernetes.io/power-node: "true"
9+
# Add wanted PowerProfiles here; valid entries are as follows: performance, balance-performance, balance-power
10+
powerProfiles:
11+
- "performance"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# MIT License
4+
#
5+
# Copyright (c) 2020 Dmitrii Ustiugov, Plamen Petrov and EASE lab
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
26+
27+
# Install K8 Power Manager
28+
git clone https://github.com/intel/kubernetes-power-manager $HOME/kubernetes-power-manager
29+
cd $HOME/kubernetes-power-manager
30+
31+
# Set up the necessary Namespace, Service Account, and RBAC rules for the Kubernetes Power Manager
32+
kubectl apply -f config/rbac/namespace.yaml
33+
kubectl apply -f config/rbac/rbac.yaml
34+
35+
# Generate the CRD templates, create the Custom Resource Definitions, and install the CRDs
36+
make
37+
38+
# Built Docker images locally
39+
make images
40+
41+
# Apply Power Manager Controller
42+
kubectl apply -f config/manager/manager.yaml
43+
44+
# Apply PowerConfig -> create the power-node-agent DaemonSet that manages the Power Node Agent pods.
45+
kubectl apply -f ${PWD}/powerconfig.yaml
46+
47+
# Apply Profile. U can modify the spec in the shared-profile.yaml file
48+
kubectl apply -f ${PWD}/shared-profile.yaml
49+
50+
# Apply the shared PowerWorkload. All CPUs (except reservedCPUs specified in this yaml file) will be tuned ti the specified frequency in shared-profile.yaml
51+
kubectl apply -f ${PWD}/shared-workload.yaml
52+
53+
kubectl get powerprofiles -n intel-power
54+
kubectl get powerworkloads -n intel-power
55+
56+
57+
58+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: "power.intel.com/v1"
2+
kind: PowerProfile
3+
metadata:
4+
name: shared
5+
spec:
6+
name: "shared"
7+
max: 1500
8+
min: 1000
9+
# A shared PowerProfile must have the EPP value of 'power'
10+
epp: "power"
11+
governor: "powersave"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: "power.intel.com/v1"
2+
kind: PowerWorkload
3+
metadata:
4+
# Replace <NODE_NAME> with the Node you intend this PowerWorkload to be associated with
5+
name: shared-<NODE_NAME>-workload
6+
namespace: intel-power
7+
spec:
8+
# Replace <NODE_NAME> with the Node you intend this PowerWorkload to be associated with
9+
name: "shared-<NODE_NAME>-workload"
10+
allCores: true
11+
reservedCPUs:
12+
# IMPORTANT: The CPUs in reservedCPUs should match the value of the reserved system CPUs in your Kubelet config file
13+
- 0
14+
- 1
15+
powerNodeSelector:
16+
# The label must be as below, as this workload will be specific to the Node
17+
kubernetes.io/hostname: <NODE_NAME>
18+
# Replace this value with the intended shared PowerProfile
19+
powerProfile: "shared"

0 commit comments

Comments
 (0)