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
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.
- macOS
- Linux
- Windows
- NixOS/Nixpkgs
On macOS, you can use Homebrew to install and update Glasskube.
brew install glasskube/tap/glasskube
You can install Glasskube using one of the package managers below.
RPM-based installation (RedHat/CentOS/Fedora)
dnf install https://releases.dl.glasskube.dev/glasskube_v0.25.0_amd64.rpm
DEB-based installation (Ubuntu/Debian)
curl -LO https://releases.dl.glasskube.dev/glasskube_v0.25.0_amd64.deb
sudo dpkg -i glasskube_v0.25.0_amd64.deb
APK-based installation (Alpine)
curl -LO https://releases.dl.glasskube.dev/glasskube_v0.25.0_amd64.apk
apk add --allow-untrusted glasskube_v0.25.0_amd64.apk
If you are using a distribution that does not use one of the package managers above, or require a 32-bit binary, check out additional download options attached to our latest release.
Download the windows archive from our latest Release and unpack it using Windows Explorer.
You can either use the package temporarily in a nix-shell:
nix-shell -p glasskube
Or install it globally by adding pkgs.glasskube
to your environment.systemPackages
.
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
- GUI 🖥️
- CLI 🧑💻
Start the UI via the command line:
glasskube serve
Install ingress-nginx via the Glasskube UI.
A package can be installed with a simple command.
glasskube install ingress-nginx
The process will wait until the package got successfully installed.
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:
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:
- Ingress-nginx documentation: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/
- Ingress configuration: https://kubernetes.io/docs/concepts/services-networking/ingress/
- Ingress controllers: https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/