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
Enabling and Configuring the Resource Manager
To enable the Resource Manager:
- Once enabled, the Resource Manager will start a cron job every 5 minutes to compute the recommendations
Activate the Resource Manager's Recommendations Through the UI:
- Log in to the Okteto Admin UI
- Navigate to Admin -> General where you can manage system-level settings
- Locate the Resource Manager section. If the Resource Manager is installed but not yet enabled, you will see an "Manual/Automatic" toggle switch
- Toggle the switch to "Automatic". This will activate the Resource Manager
Once activated, the Resource Manager will immediately begin adjusting resource requests based on average utilization.
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
Customizing Resource Manager Settings
You can customize the Resource Manager by adjusting the following settings in your Helm configuration:
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.
Recommendations Banner
If the Resource Manager is not activated and it detects potential improvements, a banner will appear in the Okteto Dashboard. This banner will:
- Highlight performance issues or inefficiencies
- Provide links to the Metrics tab where you can view detailed recommendations
- Encourage enabling the Resource Manager if it is currently disabled
The banner encourages you to review these recommendations and, if the Resource Manager is not enabled, to activate it for automated management. You can interact with the banner to view a detailed list of resources with recommendations.
Rolling Back Changes
If you find that the Resource Manager's recommendations are not suitable for your workload, you can override its behavior:
Update the annotation dev.okteto.com/resource-manager
to false
to your pod's metadata to prevent automatic adjustments.
Roll back to previous resource settings manually if needed.
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.