0
0
Kubernetesdevops~10 mins

Why Ingress manages external access in Kubernetes - Visual Breakdown

Choose your learning style9 modes available
Process Flow - Why Ingress manages external access
User sends request to cluster IP
Ingress Controller receives request
Ingress rules check request path & host
Route to Service A
Service A Pod
Response sent back
Ingress acts as a gatekeeper that receives external requests and routes them inside the cluster based on rules.
Execution Sample
Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /app1
        pathType: Prefix
        backend:
          service:
            name: app1-service
            port:
              number: 80
This Ingress resource routes requests with host 'example.com' and path starting with '/app1' to the 'app1-service'.
Process Table
StepRequest HostRequest PathIngress Rule MatchService Routed ToAction
1example.com/app1/homeHost matches example.com, Path prefix /app1app1-serviceRoute request to app1-service
2example.com/app2/homeHost matches example.com, Path prefix /app1 (No)No matchReturn 404 or default backend
3other.com/app1/homeHost does not match example.comNo matchReturn 404 or default backend
💡 Requests stop routing when no matching Ingress rule is found or after routing to the correct service.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3
Request Hostnoneexample.comexample.comother.com
Request Pathnone/app1/home/app2/home/app1/home
Matched Servicenoneapp1-servicenonenone
Key Moments - 2 Insights
Why does a request with host 'other.com' not get routed to any service?
Because the Ingress rule only matches requests with host 'example.com' as shown in execution_table row 3, so no routing occurs.
What happens if the request path does not start with the specified prefix in the Ingress rule?
The request does not match the path rule and is not routed to the service, as seen in execution_table row 2 where '/app2/home' does not match '/app1' prefix.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, which service does the request with path '/app1/home' and host 'example.com' route to?
Aapp1-service
Bapp2-service
CNo service, returns 404
DDefault backend
💡 Hint
Check row 1 in the execution_table where host and path match the Ingress rule.
At which step does the request fail to match any Ingress rule due to host mismatch?
AStep 1
BStep 2
CStep 3
DNone
💡 Hint
Look at the 'Request Host' column in execution_table row 3.
If the path prefix in the Ingress rule changed to '/app2', what would happen to the request at step 1?
AIt would route to app1-service
BIt would not match and return 404
CIt would route to app2-service
DIt would route to default backend
💡 Hint
Compare the path '/app1/home' with the new prefix '/app2' in execution_table logic.
Concept Snapshot
Ingress manages external access by acting as a traffic router.
It listens for requests from outside the cluster.
Routes requests based on host and path rules.
Sends traffic to the correct internal service.
If no rule matches, returns 404 or default backend.
Ingress simplifies exposing multiple services securely.
Full Transcript
Ingress in Kubernetes manages external access by receiving requests from outside the cluster and routing them to internal services based on rules. The Ingress controller checks the host and path of each request against defined rules. If a request matches a rule, it is forwarded to the specified service. If no rules match, the request is rejected or sent to a default backend. This allows multiple services to be exposed through a single external IP with clear routing rules.