Skip to content

(code provided) Minimal k8s aspire application generates invalid YAML assets: duplicate ports, invalid values, etc. #14029

@dmitrynovik

Description

@dmitrynovik

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Use minimal aspire app created with aspire new and configured to be deployed to k8s provided here).

  • Create a free tier AKCS cluster named mi-k8s
  • Create container registry aspireapp
  • Execute a simple BASH shell script in here which does aspire deploy, helm pack . and helm install

Note the following issues

  1. .WithContainerRegistry in AppHost's code has no effect: the passed private registry is ignored, and instead images are pulled from docker.io which results in an image pull error.

  2. Note a number of errors pointing that YAML assets generated by aspire deploy are invalid:

Upgrade "aspire-app" failed: failed to create resource: Service "apiservice-service" is invalid: [spec.ports[0].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8080, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}]
Error: UPGRADE FAILED: failed to create resource: Service "apiservice-service" is invalid: [spec.ports[0].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8080, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}]
helm.go:92: 2026-01-21 15:43:35.593857 +1100 AEDT m=+1.191704401 [debug] Service "apiservice-service" is invalid: [spec.ports[0].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1].targetPort: Invalid value: "8080": must contain at least one letter (a-z), spec.ports[1]: Duplicate value: core.ServicePort{Name:"", Protocol:"TCP", AppProtocol:(*string)(nil), Port:8080, TargetPort:intstr.IntOrString{Type:0, IntVal:0, StrVal:""}, NodePort:0}]
failed to create resource

  1. The YARP pod is crashing
 k -n test logs gateway-deployment-6d4b94464c-prddm
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
      Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
      User profile is available. Using '/home/app/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
info: Yarp.ReverseProxy.Configuration.ConfigProvider.ConfigurationConfigProvider[1]
      Loading proxy data from config.
fail: Microsoft.Extensions.ServiceDiscovery.ServiceEndpointWatcher[4]
      Error resolving endpoints for service 'https+http://apiservice'.
      System.Collections.Generic.KeyNotFoundException: The endpoint configuration section for service 'apiservice' endpoint 'https' has an invalid value with key '0'.
         at Microsoft.Extensions.ServiceDiscovery.Configuration.ConfigurationServiceEndpointProvider.AddEndpoint(List`1 endpoints, IConfigurationSection section, String endpointName) in /_/src/Microsoft.Extensions.ServiceDiscovery/Configuration/ConfigurationServiceEndpointProvider.cs:line 196
         at Microsoft.Extensions.ServiceDiscovery.Configuration.ConfigurationServiceEndpointProvider.PopulateAsync(IServiceEndpointBuilder endpoints, CancellationToken cancellationToken) in /_/src/Microsoft.Extensions.ServiceDiscovery/Configuration/ConfigurationServiceEndpointProvider.cs:line 126
         at Microsoft.Extensions.ServiceDiscovery.ServiceEndpointWatcher.RefreshAsyncInternal() in /_/src/Microsoft.Extensions.ServiceDiscovery/ServiceEndpointWatcher.cs:line 150

Expected Behavior

The helm chart is generated and installed to my mi-k8s k8s cluster

Steps To Reproduce

Follow the describe section.

Exceptions (if any)

No response

.NET Version info

dotnet --version
10.0.102
aspire --version
13.1.0+8a4db1775c3fbae1c602022b636299cb04971fde

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions