assuming a two k8s or minikube node cluster
kubectl create deploy web --image=gcr.io/google-samples/hello-app:1.0 --replicas=3 kubectl get deploy -o wide kubectl get pods -o wide
==> here one pod on node1 and two pods on node2
kubectl expose deploy web --type=NodePort --port=8080 kubectl get svc -o wide
and check
curl -i http://192.168.49.2:30xxx curl -i http://192.168.49.3:30xxx
==> goes to 3 different hostnames/pods whatever node you are talking to
note it will always go to the same pod if you use a web browser… (thanks to the keepalive feature that is enabled by default)
kubectl delete svc web kubectl delete deploy web
type NodePort is already balancing across the cluster, not sure what type LoadBalancer is useful for
#kubectl expose deployment web --type=LoadBalancer --port=8080
https://minikube.sigs.k8s.io/docs/start/
https://kubernetes.io/docs/tutorials/hello-minikube/
https://minikube.sigs.k8s.io/docs/tutorials/multi_node/
https://minikube.sigs.k8s.io/docs/tutorials/multi_node/
https://pet2cattle.com/2021/01/multinode-minikube
https://www.cnblogs.com/zhangmingcheng/p/17640118.html