home / skills / thebushidocollective / han / helm-charts

This skill helps you understand and create Helm charts for Kubernetes deployments, guiding chart structure, values, dependencies, and best practices.

npx playbooks add skill thebushidocollective/han --skill helm-charts

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.6 KB
---
name: helm-charts
user-invocable: false
description: Use when understanding and creating Helm charts for packaging and deploying Kubernetes applications.
allowed-tools: []
---

# Helm Charts

Understanding and creating Helm charts for Kubernetes applications.

## Chart Structure

```
mychart/
├── Chart.yaml          # Chart metadata
├── values.yaml         # Default values
├── charts/            # Chart dependencies
├── templates/         # Template files
│   ├── NOTES.txt     # Usage notes
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── _helpers.tpl  # Template helpers
│   └── tests/        # Test files
└── .helmignore       # Files to ignore
```

## Chart.yaml

```yaml
apiVersion: v2
name: my-app
user-invocable: false
description: A Helm chart for my application
type: application
version: 1.0.0
appVersion: "1.0.0"
keywords:
  - web
  - api
maintainers:
  - name: Your Name
    email: [email protected]
dependencies:
  - name: postgresql
    version: "12.1.0"
    repository: "https://charts.bitnami.com/bitnami"
    condition: postgresql.enabled
```

## values.yaml

```yaml
replicaCount: 3

image:
  repository: myapp
  pullPolicy: IfNotPresent
  tag: "1.0.0"

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: false
  className: "nginx"
  hosts:
    - host: myapp.local
      paths:
        - path: /
          pathType: Prefix

resources:
  limits:
    cpu: 500m
    memory: 512Mi
  requests:
    cpu: 250m
    memory: 256Mi

autoscaling:
  enabled: false
  minReplicas: 2
  maxReplicas: 10
  targetCPUUtilizationPercentage: 80
```

## Common Commands

### Create Chart

```bash
helm create mychart
```

### Install Chart

```bash
# Install from directory
helm install myrelease ./mychart

# Install with custom values
helm install myrelease ./mychart -f custom-values.yaml

# Install with value overrides
helm install myrelease ./mychart --set image.tag=2.0.0
```

### Upgrade Chart

```bash
helm upgrade myrelease ./mychart

# Upgrade or install
helm upgrade --install myrelease ./mychart
```

### Validate Chart

```bash
# Lint chart
helm lint ./mychart

# Dry run
helm install myrelease ./mychart --dry-run --debug

# Template rendering
helm template myrelease ./mychart
```

### Manage Releases

```bash
# List releases
helm list

# Get release status
helm status myrelease

# Get release values
helm get values myrelease

# Rollback
helm rollback myrelease 1

# Uninstall
helm uninstall myrelease
```

## Dependencies

### Chart.yaml

```yaml
dependencies:
  - name: redis
    version: "17.0.0"
    repository: "https://charts.bitnami.com/bitnami"
    condition: redis.enabled
    tags:
      - cache
```

### Update Dependencies

```bash
helm dependency update ./mychart
helm dependency build ./mychart
helm dependency list ./mychart
```

## Chart Repositories

```bash
# Add repository
helm repo add bitnami https://charts.bitnami.com/bitnami

# Update repositories
helm repo update

# Search charts
helm search repo nginx

# Search hub
helm search hub wordpress
```

## Best Practices

### Version Conventions

- Chart version: Semantic versioning (1.2.3)
- App version: Application version (v1.0.0)

### Default Values

Provide sensible defaults in values.yaml:

```yaml
# Good defaults
resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi

# Allow customization
config: {}
env: {}
```

### Documentation

Include NOTES.txt for post-installation instructions:

```
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

To learn more about the release, try:

  $ helm status {{ .Release.Name }}
  $ helm get all {{ .Release.Name }}
```

Overview

This skill helps you understand, author, and maintain Helm charts for packaging and deploying Kubernetes applications. It covers chart structure, common files (Chart.yaml, values.yaml, templates), dependency management, and typical Helm commands for install, upgrade, lint, and template rendering. Use it to quickly produce reliable, configurable charts and follow Helm best practices.

How this skill works

The skill inspects chart structure and common manifests, explaining metadata in Chart.yaml and default configuration in values.yaml. It explains templating patterns in templates/ and helper files, how to declare and update dependencies, and how to run Helm commands for install, upgrade, linting, and dry-runs. It highlights sensible defaults, versioning conventions, and post-installation notes to improve user experience and maintainability.

When to use it

  • Creating a new Helm chart from scratch or bootstrapping with helm create.
  • Packaging an application for deployment to Kubernetes clusters.
  • Adding or updating chart dependencies (e.g., Postgres, Redis).
  • Validating templates, performing dry-runs, or debugging releases.
  • Upgrading, rolling back, or retrieving release status and values.

Best practices

  • Follow semantic versioning for chart version and keep appVersion distinct.
  • Provide sensible defaults in values.yaml and allow overrides via -f or --set.
  • Keep templates DRY using _helpers.tpl and name-spaced helpers.
  • Use helm lint and --dry-run --debug before applying to clusters.
  • Document post-install steps in templates/NOTES.txt for operator guidance.

Example use cases

  • Create mychart with helm create, customize values.yaml, and deploy with helm install.
  • Add a database dependency in Chart.yaml and run helm dependency update to vendor charts.
  • Perform a safe upgrade with helm upgrade --install and preview changes with helm template.
  • Troubleshoot a failing deployment with helm status, helm get values, and helm rollback.
  • Publish and consume charts from a repository with helm repo add and helm search repo.

FAQ

How do I override defaults for a specific environment?

Provide an environment-specific values file and install with -f env-values.yaml or pass overrides using --set key.subkey=value.

When should I use chart dependencies vs including resources directly?

Use dependencies for separately maintained services (databases, caches) to reuse upstream charts and keep your chart focused on your application.