Skip to content

onlyutkarsh/k8s-nodejs-api

Repository files navigation

Simple Node API exposed via K8s Service

Typescript

Install dependencies

npm run init

Run the service

npm run dev

Compile the typescript

npm run compile

Docker

Build image

npm run docker:build

Run image locally

npm run docker:run

Push the image

Ensure you are logged in using docker CLI with command docker login and password (or PAT token if you have 2FA).

docker push onlyutkarsh/k8s-nodejs-api:latest

Kubernetes

Deploy Deployment and Service

$ cd k8s/
$ kubectl apply -f deployment.yml
$ kubectl apply -f service.yml

Expose Service

minikube service mynodeapi-svc --url

You will see the URL something like http://192.168.64.3:32176

Access the service

curl -X POST \
 -H "Content-Type: application/json" \
 -d '{ "id" : "5" }' \
http://192.168.64.3:32176/api/dummy

View logs of all pods and follow

k logs -f -l app=pod-k8s-nodejs-api

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published