# KubernetesEnvironmentResource

- Module: [Aspire.Hosting.Kubernetes](/reference/api/go/aspire.hosting.kubernetes.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Represents a Kubernetes environment resource that can host application resources.

## Remarks

This resource models the Kubernetes publishing environment used by Aspire when generating
Helm charts and other Kubernetes manifests for application resources that will run on a
Kubernetes cluster.

## Definition

```go
type KubernetesEnvironmentResource interface {
    ComputeEnvironmentResource
    Resource
}
```

## Embeds

- `ComputeEnvironmentResource`
- `Resource`

## Properties

- `DashboardEnabled`: `bool` `get/set` -- Determines whether to include an Aspire dashboard for telemetry visualization in this environment.
- `DefaultImagePullPolicy`: `string` `get/set` -- Gets or sets the default policy that determines how Docker images are pulled during deployment. Possible values are: "Always" - Always attempt to pull the image from the registry. "IfNotPresent" - Pull the image only if it is not already present locally. "Never" - Never pull the image, use only the local image. The default value is "IfNotPresent".
- `DefaultServiceType`: `string` `get/set` -- Gets or sets the default Kubernetes service type to be used when generating artifacts.
- `DefaultStorageClassName`: `*string` `get/set` -- Specifies the default name of the storage class to be used for persistent volume claims in Kubernetes. This property allows customization of the storage class for specifying storage requirements such as performance, retention policies, and provisioning parameters. If set to null, the default storage class for the cluster will be used.
- `DefaultStorageReadWritePolicy`: `string` `get/set` -- Gets or sets the default access policy for reading and writing to the storage.
- `DefaultStorageSize`: `string` `get/set` -- Gets or sets the default storage size for persistent volumes.
- `DefaultStorageType`: `string` `get/set` -- Specifies the default type of storage used for Kubernetes deployments.
- `KubeConfigPath`: `*string` `get/set` -- Gets or sets the path to an explicit kubeconfig file for Helm and kubectl commands. When set, all Helm and kubectl commands will use `--kubeconfig` to target this file instead of the default `~/.kube/config`.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property

## Methods

- [AddCertManager](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addcertmanager.md) -- `method` -- Installs cert-manager into a Kubernetes environment
  ```go
  AddCertManager(name string, options ...*AddCertManagerOptions) CertManagerResource
  ```
- [AddGateway](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addgateway.md) -- `method` -- Adds a Kubernetes Gateway API Gateway resource to the application model as a child of the specified Kubernetes environment. The gateway generates a `gateway.networking.k8s.io/v1 Gateway` resource and one or more `HTTPRoute` resources in the Helm chart output at publish time.
  ```go
  AddGateway(name string) KubernetesGatewayResource
  ```
- [AddHelmChart](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addhelmchart.md) -- `method` -- Adds an external Helm chart to be installed in the Kubernetes environment. The chart is installed via `helm upgrade --install` as a pipeline step after the main application Helm chart is deployed.
  ```go
  AddHelmChart(name string, chartReference string, chartVersion string) KubernetesHelmChartResource
  ```
- [AddIngress](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addingress.md) -- `method` -- Adds a Kubernetes Ingress resource to the application model as a child of the specified Kubernetes environment. The ingress generates a `networking.k8s.io/v1 Ingress` resource in the Helm chart output at publish time.
  ```go
  AddIngress(name string) KubernetesIngressResource
  ```
- [AddNodePool](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addnodepool.md) -- `method` -- Adds a named node pool to the Kubernetes environment.
  ```go
  AddNodePool(name string) KubernetesNodePoolResource
  ```
- [AddPersistentVolume](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/addpersistentvolume.md) -- `method` -- Adds a Kubernetes PersistentVolumeClaim resource
  ```go
  AddPersistentVolume(name string) KubernetesPersistentVolumeResource
  ```
- [ConfigureDashboard](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/configuredashboard.md) -- `method` -- Configures the dashboard properties for this Kubernetes environment.
  ```go
  ConfigureDashboard(configure func(obj KubernetesAspireDashboardResource)) KubernetesEnvironmentResource
  ```
- [WithDashboard](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/withdashboard.md) -- `method` -- Enables the Aspire dashboard for telemetry visualization in this Kubernetes environment.
  ```go
  WithDashboard(options ...*WithDashboardOptions) KubernetesEnvironmentResource
  ```
- [WithHelm](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/withhelm.md) -- `method` -- Configures the Kubernetes environment to deploy using Helm charts.
  ```go
  WithHelm(options ...*WithHelmOptions) KubernetesEnvironmentResource
  ```
- [WithProperties](/reference/api/go/aspire.hosting.kubernetes/kubernetesenvironmentresource/withproperties.md) -- `method` -- Allows setting the properties of a Kubernetes environment resource.
  ```go
  WithProperties(configure func(obj KubernetesEnvironmentResource)) KubernetesEnvironmentResource
  ```
