Latest
Kubernetes 1 min read

Run a Web Application on a Local kind Cluster

Run a Web Application on a Local kind Cluster
Kubernetes · November 28, 2026

Version note: examples use the Kubernetes v1.35 documentation snapshot. Check kind and controller compatibility. No live cluster or TLS deployment was executed for these articles.

What this guide covers

kind runs Kubernetes nodes as containers on your computer. This guide creates a local test cluster, loads a web application image and exposes it with a Kubernetes Service.

Before you start

Install Docker, kind and kubectl. Use the application and Dockerfile from the Node.js container guide. Select a kind node image supported by your kind release. This cluster is for learning and is not highly available.

Step 1: Check tools and select the node image

Run:

docker context show
docker version
kind version
kubectl version --client
read -r -p 'Approved kindest/node image reference with verified digest: ' KIND_NODE_IMAGE
export KIND_NODE_IMAGE
if kind get clusters | grep -Fxq web-demo; then
  printf 'Stop: web-demo already exists; inspect it before continuing.\n' >&2
  exit 1
fi

Choose the node image from the official kind release notes, including its verified digest. Both node containers share your computer’s resources.

Step 2: Create the cluster

Save this as kind-workbench.yaml:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker

Create the cluster:

: "${KIND_NODE_IMAGE:?Choose an approved compatible kind node image}"
kind create cluster --name web-demo --config kind-workbench.yaml --image "$KIND_NODE_IMAGE"
kubectl --context kind-web-demo get nodes -o wide
kubectl --context kind-web-demo -n kube-system get pods

Wait for both nodes to become Ready before continuing.

Step 3: Build and load the application

From the application repository root:

node --test src/handler.test.mjs
docker build --pull -t example-web:kind-1 .
kind load docker-image example-web:kind-1 --name web-demo

Loading copies the local image into the kind nodes. It does not publish it to a registry or make it available in another cluster.

Step 4: Create the Deployment and Service

Save this as app.yaml:

apiVersion: v1
kind: Namespace
metadata:
  name: web-demo
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
  namespace: web-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web-app
  template:
    metadata:
      labels:
        app: web-app
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        runAsGroup: 1000
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: api
          image: example-web:kind-1
          imagePullPolicy: Never
          ports:
            - name: http
              containerPort: 3210
          resources:
            requests:
              cpu: 100m
              memory: 32Mi
            limits:
              cpu: 500m
              memory: 128Mi
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: [ALL]
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: web-app
  namespace: web-demo
spec:
  selector:
    app: web-app
  ports:
    - port: 80
      targetPort: http

A Deployment keeps the application Pod running. A Service gives it a stable in-cluster address. imagePullPolicy: Never is intentional for this local image: it must already have been loaded.

Step 5: Apply and access the application

Run:

kubectl --context kind-web-demo apply --dry-run=server -f app.yaml
kubectl --context kind-web-demo apply -f app.yaml
kubectl --context kind-web-demo -n web-demo rollout status deployment/web-app --timeout=120s
kubectl --context kind-web-demo -n web-demo get pods -o wide
kubectl --context kind-web-demo -n web-demo get endpointslices -l kubernetes.io/service-name=web-app
kubectl --context kind-web-demo -n web-demo port-forward service/web-app 8087:80

The port-forward command stays in the foreground. In another terminal, request http://127.0.0.1:8087/api/message. Stop port forwarding with Ctrl+C.

Then test the Service from inside the cluster:

kubectl --context kind-web-demo -n web-demo exec deployment/web-app -- \
  node -e "fetch('http://web-app.web-demo.svc.cluster.local/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"

Check the result

Check the rollout, the forwarded response and the Service request separately. When finished, remove only this cluster with kind delete cluster --name web-demo. This deletes its local test data.

References

PB
Written by

Parul Bedi

Notes and guides by Parul Bedi.

Up next

Install SonarQube on Ubuntu Step by Step

Sonar November 30, 2026 4 min read
Open post

Conversation

0 comments

No comments yet. Start the conversation below.

Leave a comment

Replying to a comment.
Be kind. Markdown is not supported in comments.