...

/

Creating Ingress Resources Based on Paths

Creating Ingress Resources Based on Paths

Understand the definition of an Ingress resource and then create the objects based on this definition.

Defining an Ingress resource

We’ll try to make our go-demo-2-api Service available through port 80. We’ll do that by defining an Ingress resource with the rule to forward all requests with the path starting with /demo to the Service go-demo-2-api.

Looking into the definition

Let’s look at the Ingress’ YAML definition go-demo-2-ingress.yml:

Press + to interact
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: go-demo-2
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /demo
pathType: ImplementationSpecific
backend:
service:
name: go-demo-2-api
port:
number: 8080
  • Line 5: This time, metadata contains a field we haven’t used before. The annotations section allows us to provide additional information to the Ingress controller. As you’ll see soon, the Ingress API specification is concise and limited. That is done on purpose. The specification API defines only the fields that are mandatory for all
...
Access this course and 1400+ top-rated courses and projects.