DEV Community

Roland
Roland

Posted on

Basic k8s server

Im busy learning how to build a local server with Kubernetes. Here is a basic template if anyone is interested.

Codeberg:

RolH1992/K8S_demo: This is a basic set up of a local Kubernetes server - Codeberg.org

This is a basic set up of a local Kubernetes server

favicon codeberg.org

Github:

GitHub logo RolH1992 / K8S_demo

This is just a basic set up of a local Kubernetes server

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
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.