Exposing EventListeners Externally

By default, ClusterIP services such as the EventListener sink are accessiblewithin the cluster. There are a few ways of exposing it so that externalservices can talk to it:

Using an Ingress

You can use an Ingress resource to expose the EventListener. Thecreate-ingress Tekton task can help setup an ingressresource using self-signed certs.

Note: If you are using a cloud hosted Kubernetes solution such as GKE, thebuilt-in ingress will not work with ClusterIP services. Instead, you can usethe Nginx Ingress based approach below.

Using Nginx Ingress

The following instructions have been tested on GKE cluster running version1.13.7-gke.24. Instructions for installing nginx Ingress on other Kubernetesservices can be foundhere.

  1. apiVersion: extensions/v1beta1
  2. kind: Ingress
  3. metadata:
  4. name: ingress-resource
  5. namespace: getting-started
  6. annotations:
  7. kubernetes.io/ingress.class: nginx
  8. nginx.ingress.kubernetes.io/ssl-redirect: "false"
  9. spec:
  10. rules:
  11. - http:
  12. paths:
  13. - path: /
  14. backend:
  15. serviceName: getting-started-listener-b8rqz # REPLACE WITH YOUR SERVICE NAME FROM STEP 2
  16. servicePort: 8080
  • Try it out! Get the address of the Ingress by runningkubectl get ingress ingress-resource and noting the address field. You cancurl this IP or setup a GitHub webhook to send events to it.

Using Openshift Route

The following instructions have been tested on Openshift 4.2 cluster runningversion v1.14.6+32dc4a0. Further information can be foundhere

  • Find the service name expose by the Eventlistener service:sh oc get el <EVENTLISTENR_NAME> -o=jsonpath='{.status.configuration.generatedName}'
  • Expose the service using openshift route:sh oc expose svc/[el-listener] # REPLACE el-listener WITH YOUR SERVICE NAME FROM STEP 1
  • Get the address of the Openshift Route:sh oc get route el-listener -o=jsonpath='{.spec.host}' # REPLACE el-listener WITH YOUR SERVICE NAME FROM STEP 1
  • Try it out! You can use the url received above to setup a GitHub webhook forreceiving events or you can curl this url.