Im busy learning how to build a local server with Kubernetes. Here is a basic template if anyone is interested.
Codeberg:
Github:
A simple Node.js application for Kubernetes demonstration purposes.
Prerequisites
- Docker installed on your system
- Git (for cloning the repository)
- kubectl (for Kubernetes deployment)
- A Kubernetes cluster (minikube, kind, or cloud-based)
Quick Start with Docker
Build the Docker Image
# Apply docker group to current session (if needed)
newgrp docker
# Build the image
docker build -t demo:latest ./app
Run the Container
bash
# Run container with port mapping
docker run -d -p 3000:3000 --name test-demo demo:latest
Test the Application
bash
# Check if the application is responding
curl http://localhost:3000
# View container logs
docker logs test-demo
Expected output:
text
Server running on port 3000
Stop and Remove Container
bash
# Stop the container
docker stop test-demo
# Verify it's stopped
docker ps -a | grep test-demo
# Remove the container (if needed)
docker rm test-demo
Kubernetes Deployment
Apply Kubernetes Manifests
bash
# Navigate to k8s directory
cd k8s
# Apply…
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.