Ghost Example

Ghost is popular blogging platform written in nodejs

How to run

  • Save this example to file, e.g ghost.yaml
  • Change host names myapp.kuber.host to domain of your namespace (see your domains)
  • Run with kubectl apply -f ghost.yaml

Example Screenshot

ghost.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: ghost-storage
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 300Mi

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ghost
  labels:
    app: ghost
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: ghost
  template:
    metadata:
      labels:
        app: ghost
    spec:
      restartPolicy: Always
      containers:
        - name: ghost
          image: ghost:alpine
          resources:
            limits: { memory: "200Mi", cpu: "200m" }
          ports:
            - containerPort: 2368
          volumeMounts:
            - name: ghost-storage
              mountPath: /var/lib/ghost/content
          readinessProbe:
            httpGet:
              path: /
              port: 2368
      volumes:
        - name: ghost-storage
          persistentVolumeClaim:
            claimName: ghost-storage

---
apiVersion: v1
kind: Service
metadata:
  name: ghost
  labels:
    app: ghost
spec:
  type: LoadBalancer
  ports:
    - name: ghost-http
      port: 2368
  selector:
    app: ghost

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ghost-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    certmanager.k8s.io/cluster-issuer: letsencrypt
spec:
  tls:
    - hosts:
      - myapp.kuber.host
      secretName: myapp-kuber-host
  rules:
  - host: myapp.kuber.host
    http:
      paths:
      - path: /
        backend:
          serviceName: ghost
          servicePort: 2368