backend-and-orchestration-t.../code/kubernetes/node-server-example
2024-11-17 17:03:20 -08:00
..
Dockerfile merge files from the blockchain infra repo (#59) 2024-11-17 17:03:20 -08:00
Makefile merge files from the blockchain infra repo (#59) 2024-11-17 17:03:20 -08:00
node_example_kube_config.yaml merge files from the blockchain infra repo (#59) 2024-11-17 17:03:20 -08:00
README.md merge files from the blockchain infra repo (#59) 2024-11-17 17:03:20 -08:00
server.js merge files from the blockchain infra repo (#59) 2024-11-17 17:03:20 -08:00

deploying a node.js K8s cluster with kubectl


  • build the image:
make build:
  • run the container:
make run
  • check whether the server worked:
make curl
  • check container's status:
make status


useful commands


  • exec inside the container:
docker exec -i -t <container name from status> /bin/bash
  • check images in disk:
docker images


pushing the registry to kubernetes


  • in a real production system, well want to build images in one place, then run these images in the Kubernetes cluster
  • the system that images for distribution is called a container registry
  • using a yaml Kubernetes files (for example, the one inside node_server_example/), you can now deploy the image with:
kubectl create -f  node_example_kube_config.yaml
  • after that, you are able to create the service with:
kubectl expose deployment node-app-test
  • also, check out the service status with:
kubectl get services


cleanning up


  • removing the service and the deployment when you are done:
kubectl delete service node-app-test
kubectl delete deployment node-app-test