I'm pretty new to K8s.
I'm trying to make my app visible to the outside world. I have deployed this Nginx Ingress Controller with my apps, using Helm and helmfile which has given me an external ip address and a load balancer.
As I understand it, I now need an ingress resource
to configure the route mappings.
I plan on using this ingress resource as a starting point.
My apps are deployed in separate namespaces on port 80.
My question is: where do I put the yaml for creating the resources? I want to keep everything in Helm if possible to make managing the configuration easier, so I don't want to use kubectl
unless i have to.
helmfile
repositories:
- name: stable
url: https://charts.helm.sh/stable
- name: nginx-stable
url: https://helm.nginx.com/stable
releases:
# other apps configured here
- name: ingress-nginx
namespace: ingress
createNamespace: true
chart: nginx-stable/nginx-ingress
values:
- ./ingress/values.yaml
version: 0.10.4
installed: true
Ingress values:
---
rbac:
create: true
serviceAccount:
create: true
name: nginx-ingress-public
controller:
ingressClassResource:
enabled: true
default: true
replicaCount: 3
minAvailable: 3
updateStrategy:
rollingUpdate:
maxSurge: 3
maxUnavailable: 0
CodePudding user response:
You should deploy the ingress controller only once as it can handle all ingress traffic for your whole cluster.
Sometimes it makes sense to deploy multiple, for example we run 2 ingress controller. 1 for internal traffic (private IP) and one for external traffic (public IP).
Once you have that, you just tell your other helm releases to use its ingress class.
The ingress manifest is usually a template of your helm chart. So you put it in templates. If you do helm create my-app
, you get a good starting point, including ingress.
Once you have an ingress template in your chart, you can add some reasonable defaults for this template to the values.yaml of the chart, as usual.
When deploying the chart, you can use certain flags to override the defaults. i.e. -f
and --set
.