Deploying Ghost CMS on MicroK8s (Raspberry pi) with Public Access via Cloudflare Tunnel [Part 2]

In this part, we will set up a Cloudflare Tunnel to securely expose your Ghost CMS blog to the internet. This method provides a safe and efficient way to access your self-hosted website without opening ports on your router.


Prerequisites

Before starting, make sure:

  1. Your Ghost CMS is already up and running on MicroK8s (from Part One).
  2. You have a Cloudflare account and have set up your domain in Cloudflare.

Step 1: Create a tunnel

  1. Login to your Cloudflare account and click Zero Trust then Networks > Tunnels
  2. click on Create a tunnel then choose select cloudflared Enter a name for your tunnel and Save tunnel

Step 2: Install and run a connector

Add cloudflare gpg key

sudo mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null

Add this repo to your apt repositories

echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list

install cloudflared

sudo apt-get update && sudo apt-get install cloudflared

run a connector with this command replace with your private key

sudo cloudflared service install "Your private key"

Step 3: Config the connection

  1. In the Public Hostnames tab, select Add a public hostname.
  2. Enter a subdomain and select a Domain from the dropdown menu. Specify any subdomain or path information.
  3. Select type HTTP url localhost then Save hostname

Conclusion

You’ve successfully set up a Cloudflare Tunnel to expose your Ghost CMS blog running on a Raspberry Pi! Now, your blog is securely accessible from anywhere, without needing to worry about port forwarding or exposing your Raspberry Pi directly to the internet.


How to Host Ghost CMS on Raspberry Pi Using MicroK8s and Cloudflare Tunnel
Set up Ghost CMS on MicroK8s running on Raspberry Pi with persistent volumes, ingress routing, and secure exposure through Cloudflare Tunnel.