Kubernetes Handbook

    What is Kubernetes Ingress

    Introduction#

    Hello, Kubernetes learners! Ready to crack the code on how food delivery apps like Swiggy get your order from swiggy.com/restaurants to the right place? It’s all thanks to Ingress, Kubernetes’ traffic superhero! In this blog, we’ll explore what is Ingress using a Swiggy-like app, with super simple examples that’ll make you say, “I get it!” If you’ve read our Kubernetes Services chapter, you know Services send requests to app workers (pods) and LoadBalancer Services spread traffic across them. But spinning up a LoadBalancer for every Service? Ouch, that’s pricey! 😅 Ingress saves the day by using one LoadBalancer to route requests to the right services in cluster based on paths like /restaurants or /instamart. Let’s dive in and make Ingress your new best friend!

    What is Ingress?#

    Kubernetes Ingress

    Ingress exposes HTTP and HTTPS routes from outside the cluster to service within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.

    Imagine Swiggy-like food stall with two counters: one for restaurant orders (like pizza) and one for Instamart groceries (like snacks). You walk up to a cheerful guide at the entrance—that’s Ingress! You say, “I want restaurant food,” and the guide points you to the restaurant counter. Need groceries? Say “Instamart,” and they send you to the grocery counter. Without this guide, you’d be lost in a sea of hungry customers! 😜

    In Kubernetes, Ingress is that guide. It takes web requests (like swiggy.com/restaurants) and sends them to the right API Gateway counter based on the URL path. It’s a simple, smart way to manage traffic, keeping everything under one domain.

    Why Ingress is Awesome#

    Ingress example of food delivery app like swiggy
    • Guides Traffic: Sends /restaurants to the restaurant counter (restaurant-api-gateway) and /instamart to the grocery counter (instamart-api-gateway) and then to down services.
    • One Website: Keeps everything at swiggy.com so users don’t get confused, like swiggy.com/restaurants and swiggy.com/instamart instead of different website (restaurants.swiggy.com , instamart.swiggy.com).
    • Super Safe: Locks up request/response info with secure web connections (HTTPS).

    Honestly when I first set up Kubernetes, I thought Services with LoadBalancers were all I needed. Big mistake! 😅 My cloud provider spin up a LoadBalancer for every Service, and my bill looked like I’d ordered biryani for the whole city! Ingress was my hero—it’s like one super-smart LoadBalancer that routes all requests under a single website, like swiggy.com. Saved my wallet and my sanity!

    Ingress vs. Services: The Easy Breakdown#

    You might be thinking, “Don’t Services already handle traffic?” Let’s clear that up with a Swiggy-like app so you’ll never mix them up again.

    Services: The Kitchen Crew#

    A Kubernetes Service is like the kitchen crew in a food delivery app. They pass orders between workers inside the app using private addresses, but they don’t know how to deal with public web addresses like swiggy.com/restaurants. Services are awesome for keeping things organized inside the app, not for helping users on the website.

    Example 1: Restaurant Counter

    A Swiggy-like app has a restaurant API Gateway (like a counter for food orders). A Service called restaurant-api-gateway sends internal orders to restaurant workers using a private address. But it can’t handle web requests like swiggy.com/restaurants—it’s just a kitchen helper.

    Example 2: Instamart Counter

    The Instamart grocery counter has a Service called instamart-api-gateway. It passes grocery orders inside the app but doesn’t understand swiggy.com/instamart. It’s like a worker stocking shelves, not talking to customers.

    Ingress: The Website Guide#

    Ingress is the website guide who helps users coming from the internet. It looks at web addresses (like swiggy.com/restaurants) and sends them to the right API Gateway counter, like restaurant-api-gateway or instamart-api-gateway. It needs a tool called an Ingress Controller to do its job (more on that in the next blog), but for now, think of Ingress as the guide keeping everything under one website.

    Example 3: Helping Users Find Food

    You visit swiggy.com/restaurants to browse menus. Ingress sends your request to restaurant-api-gateway, which shows you pizza places. For swiggy.com/instamart, Ingress sends it to instamart-api-gateway, and you see snacks. Everything stays at swiggy.com, so it’s easy to use.

    Beginner Mistake to Avoid#

    You might think, “Can’t I make each API Gateway public without Ingress?” Sure, but it’s a mess! Each API Gateway would get its own web address, like restaurants.swiggy.com or instamart.swiggy.com. Users would hate switching websites! Ingress keeps it all at swiggy.com with paths like /restaurants and /instamart. Imagine ordering groceries from a totally different site—ugh, no thanks!

    How Ingress Works in a Food Delivery App#

    In a Swiggy-like app, one Ingress is the main guide for all web traffic. It sends requests to different API Gateway counters based on the web address, like /restaurants for food or /instamart for groceries. It’s like having one friendly guide who knows every counter in the stall.

    Here’s the super simple version:

    1. You go to swiggy.com/restaurants to order a meal.
    2. Ingress sees /restaurants and sends it to restaurant-api-gateway.
    3. The API Gateway gets your request to restaurant workers, and you see a menu.

    Example 4: Shopping for Groceries

    You visit swiggy.com/instamart to buy chips. Ingress sends the request to instamart-api-gateway, which shows you a grocery list. It’s fast because Ingress knows exactly where to point you.

    Example 5: Ordering Dinner

    You hit swiggy.com/restaurants to find butter chicken. Ingress routes it to restaurant-api-gateway, and you get a list of restaurants with delivery times. Ingress makes sure the app works smoothly, even when everyone’s hungry!

    Quick Tip: Each API Gateway counter handles its own orders (like restaurant menus or grocery lists). Ingress just makes sure users reach the right counter without needing separate websites. It’s like a guide who doesn’t cook but knows where the food is!

    My Big Oof: I once set up a food delivery app with a LoadBalancer for every Service. Users had to visit food.app.com and groceries.app.com, and they were so annoyed! My cloud bill was even angrier. 😬 Switching to Ingress was like turning a chaotic food market into a neat stall—users loved the single website, and my wallet thanked me!

    Need of Ingress#

    Ingress is a game-changer for a Swiggy-like app because it makes the app easy to use, fast, and safe. Here’s why it’s a must-have:

    One Website for All#

    Ingress keeps everything at swiggy.com, so users don’t need to visit different websites for food or groceries.

    Example 6: App and Website Fun

    You use the app for swiggy.com/instamart to grab snacks and the website for swiggy.com/restaurants to order pizza. Ingress sends both to the right API Gateway, making it feel like one big, happy app.

    Keeps Your Info Safe#

    Ingress adds a security lock (HTTPS) to protect things like your payment details.

    Example 8: Safe Grocery Payments

    When you pay for snacks at swiggy.com/instamart, Ingress makes sure your payment info is super secure. You can shop without a worry.

    When to Use Ingress (and When Not To)#

    Let’s make sure you know when to call on Ingress:

    Use Ingress For…#

    • Website Traffic: Perfect for handling web requests.
    • One Website: Keep everything at single domain swiggy.com.
    • Safe Connections: Protect user info with security locks.
    • Busy Apps: Handle lots of users without slowing down.

    Example 9: Food and Grocery Orders

    The app’s /restaurants and /instamart get tons of visitors. Ingress sends them to the right API Gateway, keeping things fast and easy.

    Conclusion#

    In this blog, you learned what is Ingress in Kubernetes with fun, easy examples from a Swiggy-like food delivery app. You saw how one Ingress guides traffic to API Gateways for /restaurants and /instamart, how it’s different from Services, and why it makes the app simple, fast, and safe. You also dodged a beginner mistake and learned when to use Ingress.

    What’s Next? In the next blog, we’ll dive into Key Components of Ingress, like Ingress Controllers and how they power a food delivery app’s traffic. Stay tuned, and keep rocking your Kubernetes journey!

    Last updated on May 06, 2025