...
Now we create an Ingress resource, to make your HTTP web server application publicly accessible. The following command linea defines an Ingress resource that forwards traffic that requests http://webserver-bar.com to the webserver
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: lb annotations: kubernetes.io/ingress.class: "openstack" octavia.ingress.kubernetes.io/internal: "false" # Set true, if you don't want your Ingress to be accessible from the public internet spec: rules: - host: webserver-bar.com http: paths: - path: /tea # Use webserver-bar.com/tea to target "tea" services pathType: Prefix # This field is mandatory. Other values are "ImplementationSpecific" and "Exact" backend: service: name: tea-svc # Enter the service name port: number: 80 # Enter the port number on which the service is listening - path: /coffee # Use webserver-bar.com/coffee to target "coffee" services pathType: Prefix # This field is mandatory. Other values are "ImplementationSpecific" and "Exact" backend: service: name: coffee-svc # Enter the service name port: number: 80 # Enter the port number on which the service is listening |
Verify Apply it and verify that Ingress Resource has been created. Please note that the IP address will not be defined right away (wait for the ADDRESS field to get populated). It is possible to follow the implementation of the LB step by step, from the creation of its components (Listener, Pool, Policy) to the assignment of the FIP, from the log of the Pod of the Ingress Controller (the whole operation can take a few minutes).
...