Deploying a Hexo Blog on Kubernetes with GitHub Actions
In this post, we’ll cover the steps to deploy a Hexo blog on Kubernetes using GitHub Actions. This setup automates the build, containerization, and deployment of the blog to your Kubernetes cluster.
Prerequisites
Hexo Installed Locally: Ensure Hexo is installed and your blog is set up.
Kubernetes Cluster: A running Kubernetes cluster with kubectl access.
Docker Registry: A registry to store your container images.
GitHub Repository: Store your Hexo blog project in a GitHub repository.
cert-manager: Installed in your Kubernetes cluster for TLS certificates.
Step 1: Containerize Your Hexo Blog
Generate Hexo Static Files:
1
hexo generate
Create a Dockerfile:
1 2 3
FROM nginx:alpine COPY public /usr/share/nginx/html EXPOSE80
Access the Blog: Navigate to https://<your-domain> in your browser.
Conclusion
By automating the build and deployment of your Hexo blog using GitHub Actions, you save time and ensure consistency in your releases. This setup is scalable and can be extended with monitoring and logging for production environments.
Let me know if you have any questions or need further assistance!