# EnvVarSourceV1

- Kind: `class`
- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Aspire.Hosting.Kubernetes.Resources`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/EnvVarSourceV1.cs)

EnvVarSourceV1 represents a source for an environment variable value in a Kubernetes resource. It provides multiple options to derive the value of an environment variable, such as from a specific key in a ConfigMap, a field reference within the resource, a resource field (e.g., CPU or memory usage), or a specific key in a Secret.

## Definition

```csharp
namespace Aspire.Hosting.Kubernetes.Resources;

public sealed class EnvVarSourceV1
{
    // ...
}
```

## Constructors

- [EnvVarSourceV1](/reference/api/csharp/aspire.hosting.kubernetes/envvarsourcev1/constructors.md#constructor)

## Properties

- [ConfigMapKeyRef](/reference/api/csharp/aspire.hosting.kubernetes/envvarsourcev1/properties.md#configmapkeyref) : [ConfigMapKeySelectorV1?](/reference/api/csharp/aspire.hosting.kubernetes/configmapkeyselectorv1.md) `get; set` -- ConfigMapKeyRef specifies a reference to a specific key within a Kubernetes ConfigMap. It allows configuring environment variables from a ConfigMap by selecting a key and its associated value. This property can be used for configuring your application with data stored in ConfigMaps, with the option to make the reference optional.
- [FieldRef](/reference/api/csharp/aspire.hosting.kubernetes/envvarsourcev1/properties.md#fieldref) : [ObjectFieldSelectorV1?](/reference/api/csharp/aspire.hosting.kubernetes/objectfieldselectorv1.md) `get; set` -- FieldRef specifies an ObjectFieldSelector which selects an APIVersioned field of an object. This can be used to extract specific pieces of information from object metadata or specification.
- [ResourceFieldRef](/reference/api/csharp/aspire.hosting.kubernetes/envvarsourcev1/properties.md#resourcefieldref) : [ResourceFieldSelectorV1?](/reference/api/csharp/aspire.hosting.kubernetes/resourcefieldselectorv1.md) `get; set` -- ResourceFieldRef is a property representing a reference to container resource fields, such as CPU or Memory. It leverages the ResourceFieldSelectorV1 type, which allows specification of container resource attributes and their output formats.
- [SecretKeyRef](/reference/api/csharp/aspire.hosting.kubernetes/envvarsourcev1/properties.md#secretkeyref) : [SecretKeySelectorV1?](/reference/api/csharp/aspire.hosting.kubernetes/secretkeyselectorv1.md) `get; set` -- SecretKeyRef defines a reference to a specific key within a Kubernetes Secret. It allows the user to map a particular secret key to an environment variable in a container.
