Skip to main content

Install ingress-nginx for Kubernetes

Learn how to install ingress-nginx using the glasskube package manager.

Prerequisites

  • Kubernetes cluster (You can easily create a local cluster by using Minikube)
  • kubectl is not a dependency for installing packages via glasskube, but it is the recommended way to interact with the cluster. We therefore recommend you install it regardless. Installation instructions are available for macOS, Linux and Windows.

Additionally, because ingress-nginx works by running a NGINX in the cluster and exposing it via a LoadBalancer Service, which is handled by a different controller that is usually provisioned by your cloud provider. If you run into issues installing ingress-nginx, please consult your cloud provider's documentation to learn how to create external load balancers for your cluster.

About ingress-nginx



info

ingress-nginx is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer.

Installation

Installing ingress-nginx can easily be achieved with the Glasskube package manager.

Install Glasskube

If you already installed glasskube you can skip this step. If not, glasskube can easily be installed the way you usually install packages for your operating system.

On macOS, you can use Homebrew to install and update Glasskube.

brew install glasskube/tap/glasskube

After installing Glasskube on your local machine, make sure to install the necessary components in your Kubernetes cluster by running glasskube bootstrap. For more information, check out our bootstrap guide.

Install ingress-nginx

Start the UI via the command line:

glasskube serve

Install ingress-nginx via the Glasskube UI.

Using ingress-nginx

You can start using ingress-nginx straight away by creating an Ingress resource. An Ingress is a specification that tells the ingress controller, in our case ingress-nginx, where to route a set of hosts and paths. To learn more about creating Ingress resources, check out the official documentation. Here is an example Ingress:

ingress.yaml
kind: Ingress
metadata:
name: your-app
namespace: default
annotations:
cert-manager.io/cluster-issuer: letsencrypt
spec:
ingressClassName: nginx
rules:
- host: app.your-company.com
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: your-app
port:
name: http
tls:
- hosts:
- app.your-company.com
secretName: your-app-tls

This Ingress tells the controller that all traffic to the domain "app.your-company.com" with a path prefix of "/" should be routed to a Service in the same namespace named "your-app". With the addition of a cert-manager.io/cluster-issuer annotation and tls block, it also instructs cert-manager to issue a certificate for this domain name. To learn more about cert-manager, check out our guide on how to install cert-manager using Glasskube.

Further links about ingress-nginx: