Kubernetes is an open source container orchestration engine for management, deployment and scaling of containerized applications. Kubernetes provides a framework to run distributed systems resiliently and allowing canary deployments and releases. It provides in-built capabilities for service discovery, automated rollouts and rollbacks, self-healing, load balancing and much more. This blog is focused on the Ingress for Kubernetes Services.

Kubernetes Ingress

Ingress allows the services within the cluster to be exposed outside the cluster. It also provides load balancing capabilities for these requests. The routing is controlled by rules defined on the Ingress resource.

For Ingress to work, the Kubernetes cluster also need to have an ingress controller, which is the implementation of Ingress. The Ingress controller is responsible for the evaluation and the processing of the Ingress rules and managing the redirections. It is the entry point to the cluster for all the requests. The Ingress controller is installed as a single or multiple pods in the cluster.

Example of Ingress and Internal Service YAML files:

The Ingress rules contains the following information:

Host:  The domain name of the application (e.g.: cloudavenue.com). If no host is provided, the rule applies to inbound HTTP traffic through the IP address.Paths: The URL sub-path associated with the Internal Services.Backend: Service name and port number of an Internal Service. Requests matching the host name and the path of the rule are sent to the particular backend.

Ingress controller can be deployed as the Kubernetes provided ingress-nginx or any other from these Ingress controllers.

Load balancing

Ingress controllers have some load balancing policies defined by default that applies to the Ingress like weighted load balancing etc.

Creating an Ingress

To create an ingress resource using the yaml file, use the following command

kubectl apply -f <yaml file path>

To create an ingress resource without using the yaml file, use the following command. This will create an ingress that maps to cloudavenue at port 8080:

kubectl create ingress cloudavenue-ingress –class=nginx –rule=cloudavenue.com/*=cloudavenue:8080

Summary

Kubernetes Ingress is a helps to expose your services outside the Kubernetes cluster. It helps in defining the routing rules on a single resource and provides options to manage and configure the rules.

Categories: Azure

Subscribe to recieve updates

Generated by Feedzy