131 lines
3.4 KiB
Markdown
131 lines
3.4 KiB
Markdown
# Basic Application Helm Chart
|
|
|
|
## Overview
|
|
This Helm chart deploys a basic application on a Kubernetes cluster with the following components:
|
|
- A deployment with configurable replicas
|
|
- A persistent volume claim for data storage
|
|
- A service for internal communication
|
|
- An ingress for external access with TLS support
|
|
|
|
## Prerequisites
|
|
- Kubernetes 1.19+
|
|
- Helm 3.0+
|
|
- PV provisioner support in the underlying infrastructure
|
|
- Ingress controller (e.g., nginx-ingress)
|
|
|
|
## Installation
|
|
|
|
### Add the repository
|
|
```bash
|
|
# If hosted in a Helm repository
|
|
helm repo add my-repo https://charts.example.com
|
|
helm repo update
|
|
```
|
|
|
|
### Install the chart
|
|
```bash
|
|
# Using default values
|
|
helm install my-release .
|
|
|
|
# Using custom values file
|
|
helm install my-release . -f values.yaml
|
|
|
|
# Using --set
|
|
helm install my-release . --set ingress.hosts[0].host=example.com
|
|
```
|
|
|
|
## Uninstallation
|
|
```bash
|
|
helm uninstall my-release
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The following table lists the configurable parameters of the chart and their default values.
|
|
|
|
| Parameter | Description | Default |
|
|
|-----------|-------------|---------|
|
|
| `replicaCount` | Number of replicas | `1` |
|
|
| `image.repository` | Image repository | `nginx` |
|
|
| `image.tag` | Image tag | `latest` |
|
|
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
|
|
| `service.type` | Kubernetes service type | `ClusterIP` |
|
|
| `service.port` | Kubernetes service port | `80` |
|
|
| `ingress.enabled` | Enable ingress | `true` |
|
|
| `ingress.className` | Ingress class name | `nginx` |
|
|
| `ingress.annotations` | Ingress annotations | `{}` |
|
|
| `ingress.hosts[0].host` | Hostname | `chart-example.local` |
|
|
| `ingress.hosts[0].paths[0].path` | Path | `/` |
|
|
| `ingress.hosts[0].paths[0].pathType` | Path type | `Prefix` |
|
|
| `ingress.tls.enabled` | Enable TLS | `true` |
|
|
| `ingress.tls.secretName` | TLS secret name | `chart-example-tls` |
|
|
| `persistence.enabled` | Enable persistence | `true` |
|
|
| `persistence.accessMode` | PVC access mode | `ReadWriteOnce` |
|
|
| `persistence.size` | PVC size | `1Gi` |
|
|
| `persistence.storageClass` | PVC storage class | `""` |
|
|
|
|
### Ingress Annotations Examples
|
|
|
|
For NGINX ingress controller:
|
|
```yaml
|
|
ingress:
|
|
annotations:
|
|
kubernetes.io/ingress.class: nginx
|
|
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
|
```
|
|
|
|
For cert-manager SSL certificates:
|
|
```yaml
|
|
ingress:
|
|
annotations:
|
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
```
|
|
|
|
## TLS Configuration
|
|
|
|
To use TLS, create a TLS secret in the namespace:
|
|
|
|
```bash
|
|
kubectl create secret tls chart-example-tls \
|
|
--cert=path/to/tls.cert \
|
|
--key=path/to/tls.key
|
|
```
|
|
|
|
Then enable it in values.yaml:
|
|
```yaml
|
|
ingress:
|
|
tls:
|
|
enabled: true
|
|
secretName: chart-example-tls
|
|
hosts:
|
|
- chart-example.local
|
|
```
|
|
|
|
## Persistence
|
|
|
|
The chart mounts a Persistent Volume at `/data`. The volume is created using dynamic volume provisioning.
|
|
|
|
## Upgrading
|
|
|
|
```bash
|
|
# Upgrade using values file
|
|
helm upgrade my-release . -f values.yaml
|
|
|
|
# Upgrade with --set flag
|
|
helm upgrade my-release . --set replicaCount=3
|
|
```
|
|
|
|
## Limitations
|
|
- The chart has been tested on Kubernetes 1.19+
|
|
- Persistent volume provisioning support in underlying infrastructure
|
|
- Ingress controller must be present in the cluster
|
|
|
|
## Contributing
|
|
If you find any issues with this chart or want to contribute improvements:
|
|
1. Fork the repository
|
|
2. Create a new branch for your changes
|
|
3. Submit a pull request
|
|
|
|
## License
|
|
This Helm chart is licensed under the MIT License.
|