Skip to content

Document Kubernetes CPU and memory requests and limits #1875

Description

Summary

Add an AppHost documentation sample showing how to configure Kubernetes CPU and memory requests and limits by customizing the generated Kubernetes workload.

Aspire already supports this for C# AppHosts through PublishAsKubernetesService. The Kubernetes and Azure Kubernetes Service integrations use the same Kubernetes publishing path, so the same sample applies to both deployment targets.

Proposed sample

builder.AddProject<Projects.Api>("api")
    .PublishAsKubernetesService(resource =>
    {
        var container = resource.Workload!.PodTemplate.Spec.Containers[0];
        container.Resources ??= new();

        container.Resources.Requests["cpu"] = "250m";
        container.Resources.Requests["memory"] = "256Mi";
        container.Resources.Limits["cpu"] = "1";
        container.Resources.Limits["memory"] = "512Mi";
    });

The documentation should explain:

  • The difference between requests (scheduling reservations) and limits (runtime caps).
  • Kubernetes quantity syntax, including examples such as 250m, 1, 256Mi, and 512Mi.
  • That CPU and memory values are optional and no defaults are added by Aspire.
  • That the customization applies to the generated pod container for both Kubernetes and AKS deployments.
  • That this is currently a C# customization surface; broader polyglot workload-model customization is a separate product/API concern.

Scope

This issue is documentation-only. It does not require a new resource-limits API in microsoft/aspire.

Activity

  1. changed the title [-]Introduce resource limits API for Kubernetes + Azure Kubernetes integration[/-] [+]Document Kubernetes CPU and memory requests and limits[/+] on Oct 12, 2026
  2. added a commit that references this issue on Nov 6, 2026
    c50fa85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions