Skip to main content

Module 10: Ingress

Ingress is a Kubernetes resource that allows you to define rules for routing external HTTP and HTTPS traffic to services within your cluster. It acts as an entry point for your applications, enabling you to manage access and load balancing. It provides a way to expose your services to the outside world, typically through a single IP address or domain name, and can handle SSL termination, path-based routing, and more.

TLDR: Native Kubernetes cannot do all of the reverse proxy magic and so we need to use ingress.

Ingress is a layer 7 routing feature.

  • Context Path -
  • Hostname based -
  • TLS/SSL termination - Two parts
  • Ingress Controller
  • Ingress Resource or Service - additional features than the kubernetes service

External DNS is needed here to route app1.domainname.com and app2.domainname.com Certificates are also needed on these for SSL/TLS Termination.

Nginx and AGIC - Note Nginx on AKS has been deprecated.

Install Nginx Service


Architecture: Public IP -> Ingress Controller -> AKS Load Balancer -> AKS Cluster

Basic ingress Manifest:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginxapp1-ingress-service
#annotations:
#kubernetes.io/ingress.class: nginx
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app1-nginx-clusterip-service
port:
number: 80

What we need to learn in this module


  • How to create a static Public IP for Ingress in Azure AKS
  • Associate that Public IP to Ingress Controller during installation.
  • We are going to create a namespace ingress-basic for Ingress Controller where all ingress controller related things will be placed.
  • In future, we install cert-manager for SSL certificates also in same namespace.
  • Caution Note: This namespace is for Ingress controller stuff, ingress resource we can create in any other namespaces and not an issue. Only condition is create ingress resource and ingress pointed application in same namespace (Example: App1 and Ingress resource of App1 should be in same namespace)
  • Create / Review Ingress Manifest
  • Deploy a simple Nginx App1 with Ingress manifest and test it
  • Clean-Up or delete application after testing

Create a static IP


Either in the portal or via the cli az aks show --resource-group aks-rg1 --name aksdemo1 --query nodeResourceGroup -o tsv

az network public-ip create --resource-group <REPLACE-OUTPUT-RG-FROM-PREVIOUS-COMMAND> --name myAKSPublicIPForIngress --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv

az network public-ip create --resource-group MC_aks-rg1_aksdemo1_centralus --name myAKSPublicIPForIngress --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv

Install Helm


This is the first time we've introduced Helm, and it is now time to install it.

Steps:

Create your namespace