Kubernetes example
For this example we will use the kind
kind create cluster --name=k8s-example
kubectl cluster-info --context kind-k8s-example
docker run --rm -it -v $PWD:/app -w /app node npm init
docker run --rm -it -v $PWD:/app -w /app node npm install express --save
docker run --rm -it -v $PWD:/app -p 80:3000 -w /app node index
kubectl apply -f k8s/pod.yaml
kubectl port-forward pod/frontend 3000:3000
kubectl delete pod frontend
kubectl apply -f k8s/replicaset.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl port-forward svc/frontend-service 3000:3000
- ClusterIP
- LoadBalancer