1
votes

I would like to install Ingress on my Kubernetes cluster with Helm, so I did

$> helm install stable/nginx-ingress
... a lot of output
NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w solemn-toucan-nginx-ingress-controller'

An example Ingress that makes use of the controller:

  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: nginx
    name: example
    namespace: foo
  spec:
    rules:
 ...

Because I'm installing everything with Helm, it is not clear to me how I should install Ingress. As you can see in the output generated by Helm, they show an example Ingress but not how I should provide it.

I can think of 2:

  • Copy the whole chart and move my ingress.yaml into the templates folder
  • Use kubectl
  • Create a Helm Chart which provides the Ingress resource

From the above 3 I like the last one most, but maybe there is another way (maybe with some configuration option)?

2
Can you say more about what Ingress resources will be created? Are many different people using this cluster who will create Ingress resources, or just you? Will you be creating many Ingress resources overtime to expose different workloads you run on the cluster over time, or just one thing? Are you creating Ingress resources to expose some set of K8s workloads, where you would then like to package the whole thing (app Deployment YAMLs, Ingress configurations, etc.) as a single artifact that you can reproducibly install elsewhere or even distribute to other people to install on their own K8s?Amit Kumar Gupta
I would say definitely don't do the first option of copying the whole chart, 99% sure you should just use kubectl, but depending on your answers to the questions in my previous comment, there's 1% chance it makes sense to create a separate Helm chart.Amit Kumar Gupta
Consider my k8s setup a Hello world, just 1 Ingress, a couple of services and pods. The nginx-ingress chart installs everything except the Ingress resource (kind: Ingress).Jeanluca Scaljeri

2 Answers

3
votes

A rough analogy here is that using Helm to install the nginx Ingress controller is like using apt-get or brew to install nginx on a machine. But you wouldn’t use apt-get to create your nginx configuration for your application and install it on that machine.

If you just have a Hello World app, apply the Ingress resources directly with kubectl. If you get to the point that you want to encapsulate all the resources that constitute your application (Services, Ingress, Deployments, Roles, RoleBindings, ServiceAccounts, etc.) into a single artifact so that other people could consume to deploy their own copies of your application on their own K8s clusters, Helm would be a packaging and distribution option you could explore using. You would put templates for your Ingress resources in your Helm chart, there’s no reason for you to try to modify the nginx controller Helm chart.

2
votes

helm install stable/nginx-ingress will install the Ingress controller, but it will not create an Ingress for your service (application). If you have a service and want to deploy it using Helm Charts, you need to add Ingress.yaml in the template folder of the service's Helm Charts. As an example, you can check Kubernetes-dashboard