This project construct several spring boot servers in kubernetes.
The nginx ingress is used as the load balancer.
The rule for load balancing is consistent hashing base on $request_uri.
The configuration can be got in https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/
- Make sure the docker, kubernetes, kubectl, helm chart are installed
- Add the NGINX Ingress Controller as below (in docker for mac, other envs pls check https://kubernetes.github.io/ingress-nginx/deploy/)
kubectl apply -f https://github.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
kubectl apply -f https://github.com/kubernetes/ingress-nginx/master/deploy/provider/cloud-generic.yaml
- Add the helm tiller to the kubernetes
kubectl create serviceaccount tiller --namespace kube-system
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account=tiller
- Use helm to deploy this project
helm upgrade --install --tiller-namespace="kube-system" helloworld chart/helloworld/
- Use the request below to check whether the servers are avaliable
curl -G "http://localhost?a=2"
- The result below means the deployment is successful.
Hello Docker World helloworld-75b55c4dd-4rdjr