Kubernetes Ingress (original) (raw)

Last Updated : 2 May, 2026

Ingress is an API object that manages external access to services within a cluster, typically via HTTP and HTTPS. It acts as a smart router or entry point, consolidating multiple routing rules into a single resource.

Key Components

  1. **Ingress Resource: Defines the routing rules for directing external traffic to internal services. This component holds all the configuration details like host-based and path-based routing.
  2. **Ingress Controller: Implements the rules defined in the Ingress Resource. It watches for changes and updates, ensuring traffic flows according to the defined configuration. Popular Ingress Controllers include NGINX, HAProxy, and Traefik.
  3. **Backend Services: The services receiving the traffic directed by Ingress. These could be any internal applications or APIs within your Kubernetes cluster.

Architecture of Kubernetes Ingress

Kubernetes Ingress acts like a traffic controller for managing the income traffic to the Kubernetes cluster. It manages the external access to the services within the kubernetes. The following are its internal concepts and terminologies:

kubernetes_ingress_architecture

Kubernetes Ingress Architecture

Working

Ingress serves as a reverse proxy that helps direct incoming traffic to the correct services within a Kubernetes cluster. It operates based on two key components:

1. Ingress Controllers

2. Ingress Rules

Kubernetes Ingress Resources

In Kubernetes, an Ingress is an API object that manages the external access to the services within the kubernetes cluster. It acts an abstraction layer for routing traffic from outside the cluster to services inside the cluster. The following are its main concepts and terminologies:

Types of Ingress

Ingress refers to an unauthorized entry or access into your system, network or physical spaces that presents the security risks and potential harm. The following are the types of ingress, each presents its own risks and challenges:

Updating an Ingress

Updating the Ingress involves in modifying the configuration file of the Routing Table. Routing rules of how external traffic is routed to services within the kubernetes cluster as to be modified. The following are steps for updating an Ingress to define rules for HTTP and HTTPS traffic to different services based on criteria like hostname and paths.

Step 1: Modify the YAML Configuration

Here, we can modify the yaml configuration file that defines the ingress resources using `kubectl edit**` or by directly modifying the YAML file.

kubectl edit ingress

Step 2: Apply Changes

After once the changes are made in the configuration file, you can apply the changes using the following command in the kubernetes cluster.

kubectl apply -f ingress.yml

Step 3: Verfiication

Once we applied the changes, we should verify whether the ingress is updated correctly or not using the following command.

kubectl get ingress

Or we can also verify it by checking the status in our kubernetes dashboard.

Step 4: Testing

It is important to test the updated configuration of ingress to ensure the traffic is routed as per expected or not. we can perform this by sending the requests to the associated services and verifying its responses.

curl http:///
curl -k https:/// # for HTTPS testing

Step 5: Rollback ( if necessary )

If the update leads to any issues or anying unexpected behaviour, we can rollback it to the previous configuration by reapplying the older YAML file.

kubectl apply -f old-ingress.yml

Ingress Configuration File Example

In this configuration file of Ingress, specification is where the whole configuration happens, we have rulesor routing rulesattribute which defines that all the requests to "shubham.com" must be forwarded to the internal service "myapp-internal-service****"**.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: myapp-ingress
spec:
rules:
- host: shubham.com
http:
paths:
- backend:
serviceName: myapp-internal-service
servicePort: 8080

Ingress, Services, and Endpoint Resources in Kubernetes

Ingress, Services, and Endpoint Resources work together to manage traffic routing in a Kubernetes environment.

1. Services in Kubernetes

2. Endpoint Resources

**Endpoint Resources are Kubernetes objects that track IP addresses and ports of Pods linked to a Service.

3. Role of Ingress

Kubernetes Ingress Controllers List

Kubernetes controller is essential for managing the inbound traffic to the kubernetes cluster. The following are the some of the widely used kubernetes Ingress Controllers:

Creating an Ingress in Kubernetes

Follow this tutorial step by step in order to create and work with Ingress configuration files in Minikube. Minikube is a one-node Kubernetes cluster where master processes and work processes both run on one node.

**Step 1: You can skip this step if you already have a Kubernetes Cluster running in your machine. But in case you don't have a Cluster running enter the following command to create Kubernetes locally using minikube:

minikube start

Starting the Minikube

Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.

adduser [USERNAME]

su - [USERNAME]

**Step 2: Let us now install ingress controller in Minikube and the way to do that is by executing minikube add-ons command. Enter the following command in your terminal:

minikube addons enable ingress

Adding Ingress addon to Minikube

**Step 3: Now we will create an ingress rule that the controller can evaluate. This is quite a complicated process.

kubectl get ns

minikube dashboard

Minikube dashboard

**Step 4: Now that we have _kubernetes-dashboard, we can check all the components inside the _kubernetes-dashboard namespace using the following command:

kubectl get all -ns kubernetes-dashboard

Listing all resources in Kubernetes dashboard

**Step 5: Now let's create the Ingress rule for the namespace _kubernetes-dashboard. This means that we will specify the namespace as _kubernetes-dashboard.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-ingress
namespace: kubernetes-dashboard
spec:
rules:

**Step 6: Now, let's apply the Ingress rule, you can do that by entering the following command in your terminal:

kubectl apply -f dashboard-ingress.yaml

kubectl get ingress -n kubernetes-dashboard

Kubernetes Ingress - CLI  mode

**Step 7: Now what we will do is we will take that address and in the hosts file, at the end we will define that mapping, we will map IP address to dashboard.com . We can do that by entering the following command:

sudo vim /etc/hosts

[IP_ADDRESS] dashboard.com

Host File

**Step 8: And with this we have finally setup the Ingress rule. We can simply go to _dashboard.com in our machine and you will get the _kubernetes dashboard there.

Kubernetes Dashboard

With that you learned the Kubernetes Ingress and it's implementation using a configuration file.