Ingress
Ingress manages external access to services in a Kubernetes cluster. To configure Ingress access we need to install
- nginx-controller
- Setup cert-manager for https access.
- ingress manifests for opening up services
upgrade helm if possible.
It's always recommended to
Upgrade nginx-controller
Quick start
kubectl get svc -n default nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'helm delete nginx-ingress --purgehelm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx/helm repo update
controller:service:loadBalancerIP: YOUR_IP_ADDRESS...
helm install ingress-nginx/ingress-nginx -n ingress-nginx --version 2.11.1 -f values.yaml
Step by step
Gather external IP
From cluster loadbalancer
kubectl get svc -n default nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
DNS lookup using any of the mapped domain
nslookup eric.dictybase.dev
The values should match each other, otherwise use the ip
from loaderbalancer query. The ip
will be
used to install the new chart.
Remove existing chart
helm delete nginx-ingress --purge
Add helm repository for ingress-nginx
The Helm stable repository is in the process of being deprecated so it is advised to use the community-supported ingress-nginx chart moving forward.
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx/helm repo update
Install the chart
2.11.1
Chart version
- Create the following
yaml
value file
controller:service:loadBalancerIP: YOUR_IP_ADDRESS...
helm install ingress-nginx/ingress-nginx -n ingress-nginx --version 2.11.1 -f values.yaml
- Verify the loadbalancer IP
kubectl get svc -n default ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
Deploy Ingress manifests
These will be deployed alongside the various services. This particular sequence of deployments should be followed at least for the first time. Here are the expected manifests to be deployed.
- Minio storage
- GraphQL auth backend
- GraphQL backend
- Frontend applications
- Kubeless functions
The GraphQL
backend depends on the auth backend, so the auth backend have to be deployed first. Certificates has to be installed and configured for secured(https) ingress access.
Rule of thumb for writing and deploying ingress manifests
- Use a single
issuer
for all the ingresses in a cluster. - Use a single domain for every ingresses. For every new domain, create a new manifests.
- Every ingress should have a unique tls name within a particular namespace.
- Try to use a consistent naming for ingresses and tlses.
Storage backend
ingress:annotations:cert-manager.io/issuer: dictybase-devsiddhosts:- name: siddstorage.dictybase.devpaths:- path: /serviceName: minioservicePort: 9000tls:- secretName: devsidd-storage-tlshosts:- siddstorage.dictybase.dev
Auth backend
ingress:annotations:cert-manager.io/issuer: dictybase-ericdevhosts:- name: ericauth.dictybase.devpaths:- path: /watchmenserviceName: gql-authserverservicePort: gql-authservertls:- secretName: ericdev-graphql-auth-tlshosts:- ericauth.dictybase.dev
GraphQL
ingress:annotations:nginx.ingress.kubernetes.io/auth-url: https://ericauth.dictybase.dev/watchmennginx.ingress.kubernetes.io/auth-method: POSTcert-manager.io/issuer: dictybase-ericdevhosts:- name: ericgraphql.dictybase.devpaths:- path: /serviceName: graphql-serverservicePort: graphql-servertls:- secretName: ericdev-graphql-tlshosts:- ericgraphql.dictybase.dev
Frontend Applications
ingress:annotations:cert-manager.io/issuer: dictybase-ericdevhosts:- name: eric.dictybase.devpaths:- path: /stockcenterserviceName: stock-centerservicePort: stock-center- path: /dictyaccessserviceName: dictyaccessservicePort: dictyaccess- path: /geneserviceName: genomepageservicePort: genomepage- path: /publicationserviceName: publicationservicePort: publication- path: /serviceName: frontpageservicePort: frontpagetls:- secretName: ericdev-frontend-tlshosts:- eric.dictybase.dev
Kubeless
ingress:annotations:nginx.ingress.kubernetes.io/rewrite-target: /$1cert-manager.io/issuer: dictybase-ericdevhosts:- name: ericfunc.dictybase.devpaths:- path: /dashboard/(.*)serviceName: dashfnservicePort: 8080- path: /publications/(.*)serviceName: pubfnservicePort: 8080tls:- secretName: ericdev-kubeless-tlshosts:- ericfunc.dictybase.dev
Install the charts
helm install dictybase/dictybase-ingress --namespace dictybase -n <ingress name> -f <manifestname>.yaml
Fresh install
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx/helm repo updatehelm install ingress-nginx/ingress-nginx -n ingress-nginx --version 2.11.1