Developing a Helm Chart for Ghost Blog with Advanced Templates and Deployment
This tutorial walks through creating a complete Helm chart for the Ghost blogging platform, covering chart scaffolding, templating with Go templates, handling multiple environments, version‑compatible Ingress, persistence, custom update strategies, and publishing the chart via a GitHub Pages repository.
Helm is easy to use, but building a custom Chart package can be challenging due to Go template syntax; this guide demonstrates the full process using the Ghost blog as an example.
First, the Ghost Docker image is run directly, then a basic Kubernetes Deployment and Service are applied with kubectl apply -f ghost/deployment.yaml ghost/service.yaml , exposing the blog via http:// :31950 .
To create a reusable Chart, helm create my-ghost generates a scaffold which is trimmed down by removing unused files. The templates/deployment.yaml and templates/service.yaml are edited to use values such as {{ .Values.replicaCount }} , {{ .Values.image }} , and environment variables, making the chart configurable.
Named templates from _helpers.tpl are introduced to generate fully‑qualified resource names and common labels, allowing multiple releases in the same namespace.
Version compatibility is addressed by detecting the Kubernetes API version for Ingress resources using .Capabilities.APIVersions.Has and conditional logic, supporting networking.k8s.io/v1 , v1beta1 , and extensions/v1beta1 formats.
Persistence is added with a configurable PVC; if persistence.enabled is true, a PersistentVolumeClaim is generated unless an existing claim is provided, otherwise an emptyDir is used.
Additional customizations include optional update strategies, node selectors, affinity, tolerations, resource limits, and health probes (startup, liveness, readiness) controlled via values.
The final chart is packaged with helm package , an index.yaml is created, and the chart is hosted on GitHub Pages. Adding the repository with helm repo add helm101 https://cnych.github.io/helm101/ allows users to search and install the chart via helm install my-ghost helm101/ .
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.