Difficulty: Introduction
Estimated Time: 20 minutes

These next steps provide an introduction to the external traffic routing with Kubernetes Ingress.

Kubernetes has advanced networking capabilities that allow Pods and Services to communicate inside the cluster's network. An Ingress enables inbound connections to the cluster, allowing external traffic to reach the correct Pod.

Ingress enables externally-reachable URLs, load balance traffic, terminate SSL, offer name-based virtual hosting for a Kubernetes cluster.

In this scenario, you will learn how to deploy and ingress controller and configure Ingress rules to manage incoming HTTP requests.

You will learn how to:

  • install the Nginx Ingress controller,
  • declare a few ingress rules,
  • use Nginx canary rules.

The Kubernetes Ingress feature has changed and improved over the years. This scenario offers the latest version of Ingress with Kubernetes 1.21 and Nginx.

Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. The software was created by Igor Sysoev and was first publicly released in 2004. A company of the same name was founded in 2011 to provide support and Nginx plus paid software.

Nginx is free and open-source software, released under the terms of a BSD-like license. A large fraction of web servers use Nginx, often as a load balancer. -- Wikipedia

You now have a better understanding of how to get started with Ingress. This is just the tip of the iceberg of all the configuration and options ingress.

Ingress History and Future

You may notice that the Ingress declarations use apiVersion: networking.k8s.io/v1. The Ingress feature took a relatively long time to get to v1 stable status in K8s 1.19. Various features languished and deprecated in alpha and beta phases for perhaps longer than it should. Fortunately, the Kubernetes release process is now more streamlined to ensure features don't overcook in the unstable ovens for too long. A good insight on the design and history of Ingress comes from Tim Hocking and you can listen to him unpack the Ingress implementation journey on the Kubernetes Podcast, Ingress, with Tim Hockin#41.

When reading articles, blogs, and instructions on Ingress, make sure you are using a recent stable version of Ingress that uses apiVersion: networking.k8s.io/v1. Also, make sure you are using a recent ingress controller that has been matched to the stable Ingress specification.

Not everyone agrees the implementation of Ingress. This community-driven need has created interesting alternatives for traffic control:

  • Meshing networks offer a richer set of features for traffic control that go far beyond Ingress. If you are serious about more traffic control, investigate a Service Mesh that can be added to Kubernetes. To get started, try scenario Istio Getting Started.

  • An emerging new resource in Kubernetes is the Gateway API. It rose from the frustrations of the shortcoming of Ingress and some believe it may replace Ingress.

You can certainly invest in these others, but knowing these Ingress fundamentals will carry you forward as your networking and routing challenges increase.

Lessons Learned

With these steps you have learned how to:

  • install the Nginx Ingress controller,
  • declare a few ingress rules,
  • use Nginx canary rules.

References


For a deeper understanding of these topics and more join
Jonathan Johnson
at various conferences, symposiums, workshops and meetups.

Software Architectures ★ Speaker ★ Workshop Hosting ★ Kubernetes & Java Specialist

Kubernetes Networking: Ingress with Nginx

Step 1 of 7

Your Kubernetes Cluster

For this scenario, Katacoda has just started a fresh Kubernetes cluster for you. Verify it's ready for your use.

kubectl version --short && \ kubectl get componentstatus && \ kubectl get nodes && \ kubectl cluster-info

The Helm package manager used for installing applications on Kubernetes is also available.

helm version --short

Kubernetes Dashboard

You can administer your cluster with the kubectl CLI tool or use the visual Kubernetes Dashboard. Use this script to access the protected Dashboard.

token.sh