liveBook · Manning

Ingress object

As explained in gRPC Microservices in Go

An Ingress is a Kubernetes API resource that defines rules for routing external HTTP and HTTPS traffic to services in a cluster.

An Ingress is a Kubernetes resource that defines how external requests reach Services by path. Pods hold application workloads, Services expose those pods as endpoints, and an Ingress maps a request path to a Service. An Ingress controller makes those rules effective for incoming traffic. section 8.2.3 section 8.2.7

For several microservices, a LoadBalancer Service per application can mean a load balancer for each one. An NGINX Ingress controller instead provides a single load balancer and routes requests according to Ingress resources. When an Ingress changes, the controller refreshes its NGINX configuration with the new paths. section 8.2.7 section 8.3.4

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: GRPC   #1
    nginx.ingress.kubernetes.io/ssl-redirect: "true"     #2
    cert-manager.io/cluster-issuer: selfsigned-issuer    #3
  name: order
spec:
  rules:
    - http:
        paths:
          - path: /Order                                 #4
            pathType: Prefix
            backend:
              service:
                name: order
                port:
                  number: 8080
  tls:
    - hosts:
        - ingress.local                                  #5

The Order service manifest maps the /Order path to the order Service on port 8080. Its annotations select NGINX, specify a gRPC backend, enable SSL redirection, and name a certificate issuer; the TLS rule names ingress.local. section 8.2.7

The controller can be installed with Helm before applying Ingress resources. For local TLS testing, the Order configuration uses a self-signed certificate and the ingress.local hostname; that certificate is for local development and is not automatically trusted by clients. Client-side certificate handling is therefore a separate step when calling the gRPC service through Ingress. section 8.2.7 section 8.3.3

How gRPC Microservices in Go covers it

How deep it goes
Works through an Order Ingress manifest, controller installation, and NGINX configuration refresh, without detailing controller internals.
Examples
Uses an /Order route to the order Service, an ingress.local TLS host, and a local gRPC request with grpcurl.
What it assumes
Builds on pods and Services before configuring Ingress, and uses gRPC for the Order service example.
What you can do after
Operate/configure it with an NGINX Ingress controller to route a gRPC service through a shared load balancer.
How it connects
Connects pods, Services, load balancers, NGINX Ingress, gRPC, TLS, and certificate management.

Also explained in

Compare how 8 books explain ingress object →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of gRPC Microservices in Go. The section links point to the parts of the book it draws on.