Studying k8s with the mini course by Erick Wendel.
Project started from an example repository.
pvc = persistent volume claim
# minikube start
# minikube dashboard
# minikube service <service_name> --url
# minikube delete
# kubectl get nodes
# kubectl get nodes -w
# kubectl get sts
# kubectl get sts -w
# kubectl get svc
# kubectl get svc -w
# kubectl get deploy
# kubectl get deploy -w
# kubectl get pod
# kubectl get pod -w
# kubectl describe nodes
# kubectl describe sts <sts_name>
# kubectl describe svc <svc_name>
# kubectl describe deploy <deploy_name>
# kubectl describe pod <pod_name>
# kubectl logs <pod_name>
# kubectl logs -f <pod_name>
# kubectl create -f file.json
# kubectl apply -f file.json
# kubectl delete -f .
# kubectl create -f .
- Node.js v8+ or Docker and Docker Compose
- Postgres running on local instance or Docker
- Install dependencies -
npm i
- Run project -
npm start
docker-compose up
- Docker hub image: erickwendel/nodejs-with-postgres-api-example
docker run -d -p 5432:5432 --name postgres \
--env POSTGRES_PASSWORD=mysecretpassword \
--env POSTGRES_DB=heroes\
postgres
docker run -p 3000:3000 \
--link postgres:postgres \
-e POSTGRES_HOST=postgres:mysecretpassword@postgres:5432 \
-e POSTGRES_DB=heroes \
-e POSTGRES_SSL=false \
erickwendel/nodejs-with-postgres-api-example:latest
- Go to swagger page -
localhost:3000/documentation