> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# em-service Chart

> Base Helm chart for deploying any CRAFT service on-premise — deployment, environment variables, secrets, ingress, HPA and probes.

# em-service Chart

`em-service` is the base Helm chart for deploying any containerised CRAFT service to a Kubernetes cluster. Every CRAFT solution chart wraps it as a subchart — one instance per component, differentiated by alias.

## Features

* Deployment with configurable replicas, update strategy and pod annotations
* Three-layer environment variable model with deduplication (see below)
* Secret injection via `envFrom` or individual `envVars` entries with `valueFrom`
* Ingress with flexible routing (standard Kubernetes Ingress and Gateway API)
* Horizontal Pod Autoscaler
* Liveness, readiness and startup probes
* PersistentVolumeClaim support
* Init containers and sidecars
* RuntimeClass for specialised runtimes

## Installation

```bash theme={null}
helm install my-service oci://ghcr.io/emergenceai/em-charts/em-service \
  --version 0.0.15 \
  --namespace my-namespace \
  --set image.repository=ghcr.io/emergenceai/my-service \
  --set image.tag=v1.0.0
```

<Note>
  **Version pin: `0.0.15`, not `0.0.16`.** Only `0.0.15` is currently published
  to the OCI registry (`helm pull --version 0.0.16` returns "manifest
  unknown"). Bump this page when a newer tag is published. The registry is
  **private** — run `helm registry login ghcr.io` before pulling; access is
  granted to the Emergence team and Solution/Agent design partners.
</Note>

## Environment variable model

Three layers, applied in order, with deduplication:

| Layer          | Format                     | Purpose                                                                                |
| -------------- | -------------------------- | -------------------------------------------------------------------------------------- |
| `env`          | `map[string]string`        | Plain-text variables. **Always wins** over `envVars`/`extraEnvVars` with the same name |
| `envVars`      | Kubernetes env object list | Full env spec — use `valueFrom` for secrets, ConfigMaps, field refs                    |
| `extraEnvVars` | Kubernetes env object list | Additional variables appended after `envVars`                                          |

**Deduplication rule:** if a key in `env` matches the `name` of an `envVars` or `extraEnvVars` entry, the list entry is suppressed. This allows parent charts to define secret-backed defaults while letting operators override with plain values without creating duplicate env entries.

```yaml theme={null}
# Typical pattern: secret default, plain override possible
env:
  LOG_LEVEL: "INFO"          # plain override

envVars:
  - name: DATABASE_URL
    valueFrom:
      secretKeyRef:
        name: my-service-secrets
        key: database-url
  - name: LOG_LEVEL          # suppressed — 'env' wins
    valueFrom:
      secretKeyRef:
        name: my-service-secrets
        key: log-level
```

## Key values

| Value                 | Default        | Description                                       |
| --------------------- | -------------- | ------------------------------------------------- |
| `replicaCount`        | `1`            | Number of replicas                                |
| `image.repository`    | `""`           | Container image repository                        |
| `image.tag`           | `""`           | Image tag                                         |
| `image.pullPolicy`    | `IfNotPresent` | Pull policy                                       |
| `imagePullSecrets`    | `[]`           | Image pull secret names                           |
| `env`                 | `{}`           | Plain-text environment variables                  |
| `envVars`             | `[]`           | Kubernetes env object list (supports `valueFrom`) |
| `service.type`        | `ClusterIP`    | Kubernetes service type                           |
| `service.port`        | `8000`         | Service port                                      |
| `ingress.enabled`     | `false`        | Enable Kubernetes Ingress                         |
| `resources`           | `{}`           | CPU/memory requests and limits                    |
| `autoscaling.enabled` | `false`        | Enable HPA                                        |

The full values reference is in `charts/em-service/values.yaml` in the em-charts repository.

## Using as a subchart

<Tip>
  For the how-to flavour (multi-component packaging, env overlays, build-and-publish, GitOps), see [Solution Developer Guide › Package and Deploy](/guides/solution-dev/package-and-deploy). This page is the values reference; that page is the workflow.
</Tip>

Service charts declare `em-service` as a subchart dependency in `Chart.yaml`:

```yaml theme={null}
# charts/my-service/Chart.yaml
apiVersion: v2
name: my-service
version: 1.0.0
dependencies:
  - name: em-service
    alias: api
    version: 0.0.15
    repository: oci://ghcr.io/emergenceai/em-charts
  - name: em-service      # second component
    alias: worker
    version: 0.0.15
    repository: oci://ghcr.io/emergenceai/em-charts
```

Configure each instance under its alias in `values.yaml`:

```yaml theme={null}
api:
  image:
    repository: ghcr.io/emergenceai/my-service-api
    tag: v1.0.0
  env:
    PORT: "8080"

worker:
  image:
    repository: ghcr.io/emergenceai/my-service-worker
    tag: v1.0.0
```

## Related

<CardGroup cols={2}>
  <Card title="em-core Chart" icon="dharmachakra" href="/deployment/helm/em-core">
    Core platform chart using em-service for platform components.
  </Card>

  <Card title="em-data-insights Chart" icon="dharmachakra" href="/deployment/helm/em-data-insights">
    Data insights solution chart extending em-core.
  </Card>

  <Card title="Helm Configuration" icon="gear" href="/deployment/helm/configuration">
    em-runtime chart configuration and deployment modes.
  </Card>
</CardGroup>
