# Secret

- 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/SecretV1.cs)
- Inherits: [BaseKubernetesResource](/reference/api/csharp/aspire.hosting.kubernetes/basekubernetesresource.md)

Represents a Kubernetes Secret resource in the v1 API version.

## Definition

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

public sealed class Secret
    : Aspire.Hosting.Kubernetes.Resources.BaseKubernetesResource
{
    // ...
}
```

## Remarks

The `Secret` class is used to store sensitive information, such as passwords, OAuth tokens, and other secrets. Secrets are encoded as key-value pairs and can be mounted into containers or referenced by other Kubernetes resources. By default, the data is Base64-encoded, and alternative string-based representations can also be used.

## Constructors

- [Secret](/reference/api/csharp/aspire.hosting.kubernetes/secret/constructors.md#constructor) -- Represents a Kubernetes Secret resource in the v1 API version.

## Properties

- [Data](/reference/api/csharp/aspire.hosting.kubernetes/secret/properties.md#data) : `Dictionary<string, string>` `get` -- Represents a collection of base64-encoded data entries within a Kubernetes Secret resource.
- [Immutable](/reference/api/csharp/aspire.hosting.kubernetes/secret/properties.md#immutable) : `bool?` `get; set` -- Indicates whether the Secret is immutable.
- [StringData](/reference/api/csharp/aspire.hosting.kubernetes/secret/properties.md#stringdata) : `Dictionary<string, string>` `get` -- Represents a dictionary of non-base64 encoded strings that will be used to populate a Kubernetes Secret object.
- [Type](/reference/api/csharp/aspire.hosting.kubernetes/secret/properties.md#type) : `string` `get; set` -- Represents the type of the Kubernetes Secret resource.
