This guide provides instructions on how to build, dockerize, and deploy a simple Deno application to a Kubernetes cluster using Kind.
- Docker
- Kubernetes CLI (kubectl)
- Kind (Kubernetes in Docker)
- Access to a Docker Hub account
-
Write your Deno application. Ensure your main file is named
app.ts
. -
Create a Dockerfile in the root of your project. Refer to the provided Dockerfile instructions in previous communications.
-
Build the Docker image:
docker build -t yourusername/deno-app:latest .
Replace
yourusername
with your Docker Hub username. -
Run the Docker container locally (optional):
docker run -it --init -p 8000:8000 yourusername/deno-app:latest
Access the application at
http://localhost:8000
.
-
Login to Docker Hub:
docker login
Enter your Docker Hub credentials.
-
Push the image to Docker Hub:
docker push yourusername/deno-app:latest
-
Create a Kind cluster:
kind create cluster
-
Load the Docker image into Kind:
kind load docker-image yourusername/deno-app:latest
-
Apply the Kubernetes manifests:
-
Deployment:
kubectl apply -f deno-deployment.yaml
-
Service:
kubectl apply -f deno-service.yaml
-
Ingress:
kubectl apply -f deno-ingress.yaml
-
- For Kind, check the Ingress IP or use port-forwarding:
kubectl port-forward service/deno-service 8080:8000
To delete the deployed resources:
kubectl delete -f deno-deployment.yaml
kubectl delete -f deno-service.yaml
kubectl delete -f deno-ingress.yaml
To delete the Kind cluster:
kind delete cluster