Skip to content

Instantly share code, notes, and snippets.

@Jamsek-m
Created January 2, 2020 21:16
Show Gist options
  • Save Jamsek-m/c7cda1d692beba631b6ebcdf11cf5188 to your computer and use it in GitHub Desktop.
Save Jamsek-m/c7cda1d692beba631b6ebcdf11cf5188 to your computer and use it in GitHub Desktop.
Setup for ingress in google kubernetes engine

Ingress config

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment