Power Management Configuration

Kubernetes Power Management is a tool that allows you to expose and use
the power control technologies present in some processors in a Kubernetes
cluster. Its main application is directed to energy control in situations
of workloads in known periods and energy optimization even in high
performance workloads.

Story: 2010737
Task: 47983
Change-Id: I596577571e5b66ddf81f86687c05350e09bbed3c
Signed-off-by: Romão Martines <romaomatheus.martinesdejesus@windriver.com>
This commit is contained in:
Romão Martines 2023-05-12 09:56:46 -04:00 committed by Davi Frossard
parent d3421cc962
commit 39052d850b
1 changed files with 372 additions and 0 deletions

View File

@ -0,0 +1,372 @@
..
This work is licensed under a Creative Commons Attribution 3.0 Unported
License. http://creativecommons.org/licenses/by/3.0/legalcode
=================================================
Kubernetes Power Manager integration on StarlingX
=================================================
Storyboard: `#2010737`_
The objective of this spec is to introduce Configurable Power Management in
StarlingX Platform.
Problem description
===================
StarlingX, on its current versions, does not offer a comprehensive set of
features for power management. There are important limitations on the maximum
frequency control that the processors can assume. Currently, this control is
generalized, i.e., it does not allow individualized control of the CPU/Cores.
Users, however, have power management needs with greater scope and higher
granularity, focused on containerized applications using power profiles
individually by Core and/or application. Among the user's needs, we can
highlight the control of acceptable frequency ranges (minimum and maximum
frequency) per core, the behavior of the core in this range (governor), which
power levels (c-states) a given core can access, as well as the behavior of
the system in the face of workloads with known intervals/demands.
`Kubernetes Power Manager`_ is a Kubernetes Operator that allows you to expose
and use the powercontrol technologies present in some processors in a
Kubernetes cluster. Its main application is directed to power control in
situations of workloads in known periods and power optimization even in high
performance workloads.
By controlling CPU performance states (P-states) and CPU idle states
(C-states), the tool allows each core to be individually controlled according
to the needs of each application's workload. Due to this feature and its
adherence to the StarlingX proposal, this spec seeks to observe the
applicability, requirements, quality of operation of the Kubernetes Power
Manager and its integration on StarlingX platform.
Below, there is a study about Kubernetes Power Manager and all required
changes regarding StarlingX Platform in :ref:`Proposed Changes` and :ref:`Work
Item`
Kubernetes Power Manager Components
-----------------------------------
* Power Manager: controls the nodes, serves as a manager, or source of truth
gathering information on the power profiles applied to each node
* Power Config Controller: part of the power manager, is responsible for
evaluating the presence of a default power configuration for the node and,
when present, starting the Power Node Agent
* Power Config: describes the power configuration of a given node
indicating one or more profiles that can be used
* Power Node Agent: per-node pod managed by a DaemonSet, responsible for
managing the power profiles applied. Communicates with Power Manager to
establish power policies to be applied to the node
* Power Profile: power profiles that establish CPU operating frequency
ranges, Energy Performance Preference (EPP), and governor. The profile has
a generic aspect, that is, it only describes a possible style of power
control, and its application is the responsibility of Power Workload. The
pods' deployment files, or Power Config files, can indicate the profiles
they want to use by including the device power.intel.com/<POWERPROFILE>.
It is also important to note that all CPUs not assigned to a specific
power profile are pooled in a profile known as the "Shared". This profile
must be created manually by the user
* Power Workload: responsible for applying a Power Profile. Its scope is
set automatically, when a pod requests a default power profile, or via a
configuration file that describes the affected CPUs. Preset profiles have
workloads created automatically. The Shared Power Profile, and other
personalized profiles, does not have an automatically assigned workload
(need to be created manually)
Use Cases
---------
After installing and enabling the Kubernetes Power Manager, the user will be
able to indicate which power settings will be assigned to the cores of a given
application. Below, 3 examples are presented, which describe common situations
of use. Further details can be consulted in the project documentation.
* Example A: The user wants the application to have high performance. Fragment
of *pod_spec.yaml* to be deployed:
.. code-block:: yaml
# (...)
resources:
requests:
cpu: "4"
memory: "1G"
power.intel.com/performance: "4"
limits:
cpu: "4"
memory: "1G"
power.intel.com/perfomance: "4"
# (...)
* Example B: On a server with only two c-state levels available (C3 and C4),
the user wants the high-performance profiled cores to be kept at higher
levels (C3) as well as idle cores to access the lowest level (C4). Fragment
of the *c-state.yaml* profile configuration file:
.. code-block:: yaml
apiVersion: power.intel.com/v1
kind: CStates
metadata:
name: worker-0
spec:
# (...)
sharedPoolCStates:
C3: false
C4: true
exclusivePoolCStates:
performance:
C3: true
C4: false
# (...)
* Example C: User wants to create a profile specific to their needs.
First step: deploy *custom-profile.yaml*. In this case the profile has the
name "one-profile". The min, max, epp, and governor can be setted by the
user.
.. code-block:: yaml
apiVersion: power.intel.com/v1
kind: PowerProfile
metadata:
name: one-profile
namespace: intel-power
spec:
name: one-profile
max: 2200
min: 2000
epp: power
governor: powersave
Second step: deploy the *pod_spec.yaml*. Fragment to be deployed:
.. code-block:: yaml
# (...)
resources:
requests:
cpu: "1"
memory: "1G"
power.intel.com/one-profile: "1"
limits:
cpu: "1"
memory: "1G"
power.intel.com/one-profile: "1"
# (...)
.. _Proposed Changes:
Proposed change
===============
The Kubernetes Power Manager, when disabled, will not offer any change in
StarlingX standard behavior (keeping the system running at maximum performance
the entire time). When activated, however, the power management system will
allow the user to apply power settings as needed under conditions described
below.
The power manager system is based on four standard power profiles and possible
user-customized profiles. Whenever a certain application needs high
performance, for example, the power profile "performance" must be declared in
its deployment file. The power manager, in turn, will configure the profile on
the Core assigned by Kubernetes to the Pod.
The default profiles "performance", "balanced-performance", "balanced-power"
and "power" will be automatically configured during the installation process.
It will be up to the user to enable new profiles as needed. All Cores not
assigned to a Pod, or idle, will have their power profile set to wide
frequency (minimum equals the minimum supported by the processor and maximum
equals the maximum supported), as currently occurs in the system without power
control.
The standard power level (c-state) that the cores will assume will also be
assigned. The user will be free to change the c-states individually,
indicating which states a certain core can assume, or by group, indicating
which states the cores of a certain power profile can assume.
All the functionalities accessible to the user can be controlled by applying
appropriate yaml files.
It is important to note that the user will be free to modify the energy
settings of the cores intended for system support (platform cores), but all
these settings will be overwritten during the lock/unlock process, in order to
maintain the integrity of the system.
After installing the Kubernetes Power Manager, it will be necessary to enable
it on the desired hosts by setting the label "power-management=enabled".
StarlingX current limitation of C-state C0 on worker nodes will be removed.
Alternatives
------------
None
Data model impact
-----------------
None
REST API impact
---------------
None
Security impact
---------------
None
Other end-user impact
---------------------
Some SysInv/Horizon commands may be deprecated with Kubernetes Power Manager
integration (see all user configurable parameters on
`Host CPU MHz Parameters Configuration`_).
In case where the user tries to use these deprecated parameters with
Kubernetes Power Manager enabled, the system should ignore these actions.
Performance Impact
------------------
None
Another deployer impact
-----------------------
None
Developer impact
----------------
None
Upgrade impact
--------------
None
Implementation
==============
Assignee(s)
-----------
Primary assignee:
* Guilherme Batista Leite (guilhermebatista)
Other contributors:
* Davi Frossard (dbarrosf)
* Eduardo Alberti (ealberti)
* Fabio Studyny Higa (fstudyny)
* Pedro Antônio de Souza Silva (pdesouza)
* Reynaldo Patrone Gomes Filho (rpatrone)
* Romão Martines (rmartine)
* Thiago Antonio Miranda (tamiranda)
Repos Impacted
--------------
* starlingx/config
* starlingx/stx-puppet
* starlingx/app-kubernetes-power-manager (new)
.. _Work Item:
Work Items
----------
Investigations and design
*************************
* Investigation and evaluation of CPU Power Manager architecture
and requirements
* Evaluation of platform and application control for p-states and
c-states
* Design proposal and review for p-state and c-state control
* Minor customizations for Kubernetes Power Manager may also be introduced, for
instance, the modification to accept the use of isolated CPUs.
Kubernetes Power Manager Integration
************************************
* Installation via system application
* Default policy configuration:
* Default p-state configuration and policy for platform cores (p-states
enabled with full frequency range)
* Default c-state configuration and policy for platform cores (c-states
enabled with maximum idle state, limited to C6)
* Default p-state configuration and policy for application cores (p-states
enabled with full frequency range)
* Default c-state configuration and policy for application cores (c-states
enabled with maximum idle state, limited to C1)
Dependencies
============
* `Kubernetes Power Manager`_ release v2.2.0
* `Node Feature Discovery`_ v0.13.1
Testing
=======
System configuration
--------------------
The system configurations that we are assuming for testing are:
* AIO-SX
* Standard
Test Scenarios
--------------
We elected some tests which should be defined or changed to cover this spec:
* Functional tests for Kubernetes Power Manager and its possible
customizations.
* The usual unit testing in the impacted code areas.
* Performance testing to identify and address any performance impacts.
* Backup and restore tests.
Documentation Impact
====================
The end-user documentation will need to be changed, adding Kubernetes Power
Manager application deployment and configuration. Also it needs to be added
the customization of default and new policies.
References
==========
#. `Kubernetes Power Manager`_
History
=======
.. list-table:: Revisions
:header-rows: 1
* - Release Name
- Description
* - stx-9.0
- Introduced
.. Abbreviations
.. |EPP| replace:: :abbr:`EPP (Energy Performance Preference)`
.. Links
.. _#2010737: https://storyboard.openstack.org/#!/story/2010737
.. _Kubernetes Power Manager: https://github.com/intel/kubernetes-power-manager
.. _Node Feature Discovery: https://github.com/kubernetes-sigs/node-feature-discovery
.. _Host CPU MHz Parameters Configuration: https://docs.starlingx.io/node_management/kubernetes/host-cpu-mhz-parameters-configuration-d9ccf907ede0.html