Nginx Ingress Controller

Let’s explore a practical example using the Nginx Ingress Controller, one of the popular implementations.

Installation

Ensure you have kubectl configured to connect to your cluster.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml

This command deploys the Nginx Ingress Controller to your cluster.

Creating an Ingress Resource

Now, let’s create a simple Ingress resource to route traffic to a specific service.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
    - host: example.com
      http:
        paths:
        - path: /app
          pathType: Prefix
          backend:
            service:
              name: app-service
              port:
                number: 80

In this example, any request to `example.com/app` will be directed to the `app-service` on port 80.

Apply this configuration to your cluster:

kubectl apply -f ingress.yaml

Expected/Similar Ouput: ingress.networking.k8s.io/example-ingress created

Testing the Ingress

You can now test the Ingress by sending a request to the specified host and path. Ensure you have the necessary DNS configurations or modify your local hosts file to map `example.com` to the cluster’s IP address.

curl http://example.com/app

If your output looks like this then, the Ingress configuration is working, and you successfully received a response from the `app-service`. The HTML content you see is a placeholder from the “Example Domain” and is indicative that the request was correctly routed to the specified service.

This confirms that the Ingress Controller is functioning as expected, and the path-based routing, as defined in the Ingress resource, is directing traffic to the appropriate backend service.

Kubernetes Ingress Controllers: Routing And Load Balancing For Services

In the dynamic landscape of containerized applications, efficiently orchestrating and managing services is critical. As an effective platform for container orchestration, Kubernetes offers a stable foundation for launching, growing, and overseeing containerized applications. The Ingress controller is a crucial part of Kubernetes that helps with efficient service administration.

We’ll examine the nuances of Kubernetes Ingress controllers in this extensive post, including how they function in service load balancing and routing. To assist you in understanding the principles and implementation specifics, we’ll go over the essentials, explore their functioning mechanisms, and offer practical examples.

Similar Reads

Understanding Kubernetes Ingress Controllers

What is an Ingress Controller?...

How Ingress Controllers Work

Request Flow in Kubernetes Ingress...

Example: Nginx Ingress Controller

Let’s explore a practical example using the Nginx Ingress Controller, one of the popular implementations....

Advanced Features of Ingress Controllers

SSL/TLS Termination...

Conclusion

In conclusion, Kubernetes Ingress Controllers play a vital role in managing external access and load balancing for services within a Kubernetes cluster. Understanding their fundamentals, components, and working mechanisms is essential for efficiently managing and routing traffic to various services....

ubernetes Ingress Controllers – FAQ’s

How do I check if the Ingress Controller is running in my Kubernetes cluster?...