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:
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 apiVersion: v1
kind: Service
metadata:
name: ghost
spec:
type: NodePort
ports:
- protocol: TCP
targetPort: 2368
port: 80Apply them with kubectl apply -f ghost/deployment.yaml ghost/service.yaml and 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.yaml to use values such as {{ .Values.replicaCount }} for replicas and environment variables for configuration.
Naming Templates
Use the generated _helpers.tpl to 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.Has and 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 ingressClassName for stable versions or the kubernetes.io/ingress.class annotation for older ones, and conditionally includes pathType when supported.
Persistence
Enable data persistence with a PVC. The chart conditionally creates a PersistentVolumeClaim when persistence.enabled is 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 toYaml for proper indentation.
Sharing Charts
Package the chart with helm package, host the .tgz and an index.yaml on 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
