https://cloud.google.com/community/tutorials/nginx-ingress-gke
Prerequisites:
- Helm installed (together with kubectl & Google cloud SDK)
1. Create service account:
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
2. Install nginx-ingress controller & backend with Helm:
helm install --namespace e-store --name nginx-ingress stable/nginx-ingress --set rbac.create=true --set controller.publishService.enabled=true
Leave out --namespace
if you are using default namespace
3. After install wait a few seconds for service to get IP, check with this command:
kubectl get service nginx-ingress-controller -n e-store
In default namespace omit -n
flag with value
Read EXTERNAL_IP from output. Test it with paths /
(which returns 404) and /healthz
(which returns empty response with status 200)
Write Ingress redirection rules and save them (kubectl create / apply).
Done! Services will be available at EXTERNAL_IP/<REDIRECT_RULE>. Example: http://EXTERNAL_IP/ratings-service/health