Mastering Helm Charts: Build a Fully Customizable Ghost Blog Deployment
Learn how to create a complete Helm chart for deploying the Ghost blogging platform on Kubernetes, covering chart scaffolding, templating with values, handling multiple environments, ingress version compatibility, persistence, customizations, and sharing the chart via a GitHub Pages repository.
Helm is easy to use, but creating a custom Chart package can be challenging due to Go template syntax. This guide walks through building a full Helm Chart for the Ghost blog application, a Node.js‑based open‑source platform.
Application
Ghost can be started with a simple Docker command, then accessed at
http://localhost:2368. To run two replicas in a Kubernetes cluster, apply the following resource manifests:
<code>apiVersion: apps/v1
kind: Deployment
metadata:
name: ghost
spec:
selector:
matchLabels:
app: ghost-app
replicas: 2
template:
metadata:
labels:
app: ghost-app
spec:
containers:
- name: ghost-app
image: ghost
ports:
- containerPort: 2368
</code> <code>apiVersion: v1
kind: Service
metadata:
name: ghost
spec:
type: NodePort
ports:
- protocol: TCP
targetPort: 2368
port: 80
</code>Apply them with
kubectl apply -f ghost/deployment.yaml ghost/service.yamland access Ghost via
http://<nodeip>:31950.
Basic Template
Create a new chart with
helm create my-ghost. Remove unused scaffold files and edit
templates/deployment.yamlto use values such as
{{ .Values.replicaCount }}for replicas and environment variables for configuration.
Naming Templates
Use the generated
_helpers.tplto replace fixed resource names with the chart or release name, ensuring multiple installations in the same namespace are possible.
Version Compatibility
Kubernetes version changes affect Ingress API versions. The guide shows how to detect the cluster version with
.Capabilities.APIVersions.Hasand render the appropriate Ingress manifest for
networking.k8s.io/v1,
v1beta1, or
extensions/v1beta1.
Ingress
Add an Ingress template that adapts to the detected API version, uses
ingressClassNamefor stable versions or the
kubernetes.io/ingress.classannotation for older ones, and conditionally includes
pathTypewhen supported.
Persistence
Enable data persistence with a PVC. The chart conditionally creates a
PersistentVolumeClaimwhen
persistence.enabledis true, otherwise uses
emptyDir. Values control storage class, access mode, and size.
Customization
Additional customizations include update strategies, node selectors, affinity, tolerations, resource limits, and optional liveness, readiness, and startup probes, all driven by values and rendered with
toYamlfor proper indentation.
Sharing Charts
Package the chart with
helm package, host the
.tgzand an
index.yamlon GitHub Pages, and add the repository with
helm repo add helm101 https://cnych.github.io/helm101/. Users can then search and install the chart via Helm.
Ops Development Stories
Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.
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.