...
What is Ingress?
In Kubernetes, an Ingress is a object that allows access to your Kubernetes services from outside the cluster. The ingress is made up of 2 parts: the kubernetes component that deals with directing external traffic to internal services is called the ingress controller, which obeys the rules present in the ingress resources. So, you configure access by creating a collection of rules, written in a file, that define which inbound connections reach which services. Without the use of the ingress, all the cluster services, to which one wishes to access from the outside, must be exposed to the internet. The advantage of the ingress consists, in fact, in exposing a single access point externally, which will take care of routing the traffic within the cluster.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
$ git clone https://github.com/nginxinc/kubernetes-ingress/ $ cd kubernetes-ingress/deployments $ git checkout v1.1011.13 |
Before continuing, let's stop for a moment, because we need to make some small changes to the files in the folder we just cloned from the GitHub repo. The files in question are located here:
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
apiVersion: networking.k8s.io/v1beta1v1 kind: Ingress metadata: name: cafe-ingress spec: # tls: # Let's ignore # - hosts: # and comment # - cafe.example.com # these lines # secretName: cafe-secret # for the moment rules: - host: cafe.example.com http: paths: - path: /tea # Use cafe.example.com/tea to target "tea" services backendpathType: Prefix serviceNamebackend: tea-svc # Enter the service name: servicePort: 80 name: tea-svc # Enter the port number service name port: number: 80 # Enter the port number on which the service is listening - path: /coffee # Use cafe.example.com/coffee to target "coffee" services pathType: Prefix backend: service: serviceName name: coffee-svc # Enter the service name servicePort: 80port: number: 80 # Enter the port number on which the service is listening |
...