Skip to content

23seriy/NELM-in-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โš“ Nelm in Action

A hands-on project demonstrating Nelm โ€” the modern Helm 4 alternative โ€” on a local Minikube cluster. Built with a simple NBA Scores API to showcase terraform plan-like diffs, continuous deployment logging, save/apply plan workflows, auto-rollback, and more โ€” all running on your laptop.

Nelm Kubernetes Minikube Python

๐Ÿ“ Read the full walkthrough on Medium: Nelm in Action: The Modern Helm Alternative on Your Laptop

๐Ÿ—๏ธ Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚              Minikube Cluster                 โ”‚
                    โ”‚              (nelm-demo profile)              โ”‚
                    โ”‚                                              โ”‚
  NBA Fan โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
  localhost:9080    โ”‚  โ”‚  Scores API v1   โ”‚   โ”‚  Scores API v2  โ”‚  โ”‚
                    โ”‚  โ”‚  (basic scores)  โ”‚   โ”‚  (+ play-by-play)โ”‚  โ”‚
                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                    โ”‚           โ”‚                      โ”‚           โ”‚
                    โ”‚     Nelm Deployment Engine                    โ”‚
                    โ”‚     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€                    โ”‚
                    โ”‚     ๐Ÿ“‹ plan  โ†’ see diffs before deploying    โ”‚
                    โ”‚     ๐Ÿš€ install โ†’ deploy with live logging    โ”‚
                    โ”‚     ๐Ÿ’พ save-plan โ†’ review โ†’ apply later      โ”‚
                    โ”‚     โ†ฉ๏ธ  auto-rollback โ†’ revert on failure     โ”‚
                    โ”‚                                              โ”‚
                    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                    โ”‚  โ”‚  ConfigMap   โ”‚   โ”‚  Secret Values    โ”‚   โ”‚
                    โ”‚  โ”‚  (welcome)   โ”‚   โ”‚  (encrypted)      โ”‚   โ”‚
                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Scores API v1 โ€” Returns basic NBA box scores (team, score, quarter, arena). The stable "production" version.

Scores API v2 โ€” Same box scores plus live play-by-play data (player actions, timestamps). The new version you deploy and plan against.

๐Ÿ“‹ What You'll Learn

Nelm Feature What It Does Demo Scenario
Plan (terraform plan) See exact resource diffs before deploying Scale replicas, change image tag โ€” review diff first
Save Plan โ†’ Apply Plan Two-stage deployment: save to file, apply later --save-plan=plan.gz then --use-plan=plan.gz
Continuous Logging Stream pod logs and events during deployment Watch real-time output as pods start
Auto-Rollback Automatically revert on deployment failure Deploy broken image โ†’ Nelm rolls back
Chart Render Template rendering (like helm template) Render chart locally without deploying
Remote Charts Deploy charts from remote repos directly Plan install of bitnami/nginx from OCI registry
Release List List all managed releases Native Nelm implementation of helm list
Helm Compatibility Deploy standard Helm charts unchanged Our chart uses standard Chart.yaml + templates/

๐Ÿš€ Quick Start

Step 0: Clone the Repository

git clone https://github.com/23seriy/nelm-in-action.git
cd nelm-in-action

Prerequisites

  • macOS (scripts use Homebrew; adapt for Linux)
  • Docker Desktop running
  • ~4 GB RAM available for the Minikube cluster

Step 1: Install Tools

chmod +x scripts/*.sh
./scripts/01-install-prerequisites.sh

This installs minikube and kubectl via Homebrew if not already present.

Step 2: Start Cluster + Install Nelm

./scripts/02-start-cluster.sh

Creates a Minikube cluster (nelm-demo profile) with 2 CPUs and 4 GB RAM, then downloads and installs the Nelm CLI to ~/.local/bin.

Note: If you want to run nelm commands directly in your terminal (outside the scripts), make sure ~/.local/bin is on your PATH:

export PATH="${HOME}/.local/bin:${PATH}"

Add the line above to your ~/.zshrc (or ~/.bashrc) to make it permanent.

Step 3: Build & Deploy the Application

./scripts/03-deploy.sh

Builds Docker images inside Minikube's Docker daemon (no registry needed), creates the namespace, and deploys the Scores API using nelm release install. Watch the continuous logging in action.

Step 4: Access the Application

In a separate terminal:

kubectl port-forward svc/scores-api 9080:8080 -n nelm-demo

Open http://localhost:9080 to see the Scores API.

Step 5: Run the Demo Scenarios

./scripts/04-demo-scenarios.sh

This walks you through each Nelm feature interactively.

๐ŸŽฎ Demo Scenarios

1. Plan โ€” terraform plan for Kubernetes

nelm release plan install -n nelm-demo -r scores-api ./charts/scores-api \
  --set replicaCount=3 --set image.tag=v2

See the exact diff: replica count change, image tag update, configmap modification โ€” all shown before anything touches the cluster. Uses Server-Side Apply dry-runs for accuracy.

2. Save Plan โ†’ Review โ†’ Apply Plan

# Save the plan
nelm release plan install -n nelm-demo -r scores-api ./charts/scores-api \
  --set replicaCount=2 --save-plan=plan.gz

# Review, then apply
nelm release install -n nelm-demo -r scores-api ./charts/scores-api \
  --use-plan=plan.gz

Two-stage deployment workflow, just like terraform plan -out=plan.gz + terraform apply plan.gz.

3. Continuous Logging During Deploy

nelm release install -n nelm-demo -r scores-api ./charts/scores-api \
  --set config.welcomeMessage="Hello from Nelm!"

Nelm streams pod logs and Kubernetes events in real-time as the deployment rolls out. The werf.io/show-service-messages: "true" annotation enables event streaming.

4. Chart Render

nelm chart render ./charts/scores-api --set replicaCount=5 --set image.tag=v2

Equivalent to helm template. Renders the chart locally and outputs the resulting manifests.

5. Deploy a Remote Chart

NELM_FEAT_REMOTE_CHARTS=true nelm release plan install -n nelm-demo -r nginx-remote \
  --chart-version 19.1.1 oci://registry-1.docker.io/bitnamicharts/nginx

Deploy charts directly from remote OCI registries. No helm repo add needed. Remote chart support requires the NELM_FEAT_REMOTE_CHARTS=true feature flag.

6. Auto-Rollback on Failure

nelm release install -n nelm-demo -r scores-api ./charts/scores-api \
  --auto-rollback --resource-readiness-timeout=30s --values nelm/values-broken.yaml

Deploy a broken image intentionally. Nelm detects the failure within the readiness timeout and automatically reverts to the previous working state. Like helm upgrade --atomic, but more reliable.

Tip: Use --resource-readiness-timeout (not --timeout) with --auto-rollback. The global --timeout kills the entire process without triggering rollback, while --resource-readiness-timeout fails the readiness check and lets the rollback logic run.

๐Ÿ“ Project Structure

nelm-in-action/
โ”œโ”€โ”€ apps/
โ”‚   โ””โ”€โ”€ scores-api/              # NBA Scores API (Flask)
โ”‚       โ”œโ”€โ”€ app.py               # v1: basic scores, v2: + play-by-play
โ”‚       โ”œโ”€โ”€ Dockerfile
โ”‚       โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ charts/
โ”‚   โ””โ”€โ”€ scores-api/              # Helm chart (standard, Nelm-compatible)
โ”‚       โ”œโ”€โ”€ Chart.yaml
โ”‚       โ”œโ”€โ”€ values.yaml
โ”‚       โ””โ”€โ”€ templates/
โ”‚           โ”œโ”€โ”€ _helpers.tpl
โ”‚           โ”œโ”€โ”€ configmap.yaml
โ”‚           โ”œโ”€โ”€ deployment.yaml  # werf.io/show-service-messages annotation
โ”‚           โ””โ”€โ”€ service.yaml
โ”œโ”€โ”€ k8s/                         # Kubernetes manifests
โ”‚   โ””โ”€โ”€ namespace.yaml
โ”œโ”€โ”€ nelm/                        # Nelm-specific value overrides
โ”‚   โ”œโ”€โ”€ values-v2-upgrade.yaml   # Upgrade to v2 with play-by-play
โ”‚   โ”œโ”€โ”€ values-scale-up.yaml     # Scale to 5 replicas + more resources
โ”‚   โ””โ”€โ”€ values-broken.yaml       # Broken image for auto-rollback demo
โ”œโ”€โ”€ scripts/                     # Automation scripts
โ”‚   โ”œโ”€โ”€ 01-install-prerequisites.sh
โ”‚   โ”œโ”€โ”€ 02-start-cluster.sh
โ”‚   โ”œโ”€โ”€ 03-deploy.sh
โ”‚   โ”œโ”€โ”€ 04-demo-scenarios.sh
โ”‚   โ””โ”€โ”€ 05-teardown.sh
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ medium-story.md          # Medium article draft
โ””โ”€โ”€ .gitignore

๐Ÿงน Teardown

./scripts/05-teardown.sh

Uninstalls all Nelm releases, deletes the namespace, and removes the Minikube cluster. Your system is back to clean state.

๐Ÿ’ก Key Takeaways

  1. Plan before you deploy โ€” nelm release plan install shows the exact diff of what will change, using Server-Side Apply dry-runs. No more "deploy and hope" โ€” you see the impact before committing.

  2. Two-stage deployments โ€” Save a plan to a file, pass it through a review/approval gate, then apply it. This brings the terraform workflow to Kubernetes.

  3. Real-time visibility โ€” Nelm streams pod logs and events during deployment. No more switching terminals to run kubectl logs while waiting for a rollout.

  4. Automatic rollback โ€” --auto-rollback reverts to the previous state on failure, more reliably than Helm's --atomic.

  5. Zero migration cost โ€” Nelm deploys standard Helm charts unchanged. It uses Helm Releases for state, so you can switch between Helm and Nelm interchangeably.

  6. Built-in secrets โ€” nelm chart secret manages encrypted values files natively, no external plugins needed.

โšก Helm โ†’ Nelm Migration Cheatsheet

Helm Command Nelm Equivalent
helm upgrade --install --atomic -n ns myrls ./chart nelm release install --auto-rollback -n ns -r myrls ./chart
helm uninstall -n ns myrls nelm release uninstall -n ns -r myrls
helm template ./chart nelm chart render ./chart
helm dependency build nelm chart dependency download
helm list nelm release list
(no equivalent) nelm release plan install
(needs helm-secrets plugin) nelm chart secret values-file edit

๐Ÿ“š Resources

๐Ÿ“ License

MIT โ€” Use freely for learning, demos, and presentations.

About

๐Ÿš€ Nelm in Action - Hands-on demos of the modern Helm 4 alternative with terraform plan-like diffs, auto-rollback, and continuous logging on local Minikube

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors