For security reasons it is not a good practice to create individual load balancers for each service.
The safer way is to create one application load balancer outside of the cluster and launch ingress controller NGINX containers to proxy the traffic to the individual services.
“Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.”
To get the list of ingresses
kubectl get ingress
To show the details of an ingress
kubectl describe ingress
Creating an ingress
- specify the URL of the application in spec: rules: – host:
- if no host set, this rule handles the request to any URL
- specify the path this rule applies to at spec: rules: – host: http: paths: – backend: path:
- set the service name at spec: rules: … backend: serviceName:
apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: ingress spec: rules: - http: paths: - path: / backend: serviceName: app1-frontend-service servicePort: 80