Resource Manager
Okteto's Resource Manager is an automated tool designed to optimize CPU and memory resource requests for your Kubernetes workloads on Okteto. By analyzing the actual utilization of resources, the Resource Manager adjusts the resource requests for your pods, ensuring they are appropriately configured without the need for manual intervention.
Why Use the Resource Manager?
Manually configuring CPU and memory requests in Kubernetes can be tedious and error-prone. Incorrect configurations can lead to poor performance, overloaded nodes, and a slow developer experience on Okteto. The Resource Manager automates this process, dynamically adjusting resource requests based on real-time usage data of the Okteto Cluster. This ensures your pods are running efficiently and your nodes are balanced well, improving overall performance and developer experience.
Key Benefits
- Improved Workflow Productivity: Automates resource configuration, allowing developers to focus on coding rather than managing Kubernetes settings
- Optimized Resource Usage: Ensures resources are neither underutilized nor over-utilized, leading to cost savings and better performance
- Enhanced Developer Adoption: Improves the performance of development environments, leading to higher satisfaction and adoption rates amongst developers
- Cost Efficiency: Reduces the overhead associated with manually configuring resources, lowering operational costs
How it Works
The Resource Manager monitors the actual CPU and memory usage of your pods over time. It calculates the average usage and automatically adjusts the resource requests for new pods based on these averages. The system uses the following process:
- Data Collection: The Resource Manager queries the Kubernetes Metric Server to collect CPU and memory usage data for all pods managed by Okteto. The Kubernetes Metric Server is required for using Resource Manager
- Average Calculation: It calculates the average CPU and memory usage for each container family (grouped by development environment, controller name, and container name)
- Recommendation Generation: The Resource Manager generates new resource requests based on the average usage, applying a correction factor to ensure efficiency
- Automatic Application: When a new pod is created, the recommended resource requests are automatically applied unless overridden the annotation
dev.okteto.com/resource-manager: false
Configuring the Resource Manager
Enabling the Resource Manager
Resource Manager is available in Okteto chart version 1.26 and above. Refer to our Helm configuration documentation for available options.
To enable the Resource Manager:
- Update and deploy your Helm chart with the Resource Manager configuration with any changes that pertain to your cluster
- Once enabled, the Resource Manager will start a cron job every 5 minutes to compute the recommendations
Activate the Resource Manager's Automatic Recommendations Through the UI:
- Log in to the Okteto Admin UI
- Navigate to Admin -> Resource Manager
- If the Resource Manager is enabled, you will see an "Manual/Automatic" toggle switch
- Toggle the switch to "Automatic", this will activate the Resource Manager's automated resource management
Once activated, the Resource Manager will immediately begin adjusting resource requests based on average utilization.
Customizing Resource Manager Settings
You can customize the Resource Manager by adjusting the following settings in your Helm configuration:
- You can find the full list of settings in our Helm Reference →
Please note that these settings will override user defined CPU and Memory Requests, when RM is configured in Automatic mode.
Viewing Resource Metrics and Recommendations
Resource Metrics View
The Resource Manager introduces a new "Metrics" tab in the Okteto Dashboard's Namespace view. It's designed to give you clear insights into the resource usage and performance of your Kubernetes workloads. This tab is available for key resources, including Deployments, StatefulSets, Jobs, CronJobs, and Pods.
- To learn more about what metrics are available, see our Namespace Documentation →
Exclude Resources
If you find that the Resource Manager's recommendations are not suitable for a specific component, you can opt-out single resources from being managed by Resource Manager.
Set the annotation dev.okteto.com/resource-manager
to false
to your pod's metadata to prevent automatic adjustments.
Example of Kubernetes manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
selector:
matchLabels:
app: hello-world
template:
metadata:
annotations:
dev.okteto.com/resource-manager: "false"
Example of Docker Compose file:
services:
hello-world:
labels:
dev.okteto.com/resource-manager: "false"
Note: Docker Compose labels are translated to Kubernetes annotations.
Disabling the Resource Manager
If you need to disable the Resource Manager temporarily, you can do so by:
- Using the toggle switch in the Admin UI to disable the Resource Managers automatic adjustments
Troubleshooting and Support
Metric Server Availability
The Resource Manager relies on the Kubernetes Metric Server. If the Metric Server is unavailable, the Okteto UI will display an error message. You can troubleshoot the Metric Server or refer to the documentation for further guidance.
Known Limitation: Support for ReplicaSet and CronJob
The Resource Manager does not automatically support optimizing ReplicaSets and CronJobs due to technical limitations. However, you can enable Resource Manager optimizations for ReplicaSets or CronJobs, by adding the label dev.okteto.com/component-name
to your resources.
Example of CronJob manifest, with dev.okteto.com/component-name
label:
apiVersion: batch/v1
kind: CronJob
metadata:
name: hello-world
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
metadata:
labels:
dev.okteto.com/component-name: "hello-world"