Ingress backends

From UVOO Tech Wiki
Jump to navigation Jump to search

https://kubernetes.io/docs/concepts/services-networking/service/

https://kubernetes.io/docs/concepts/services-networking/service/#external-ips

https://voyagermesh.com/docs/10.0.0/guides/ingress/http/external-svc/

https://voyagermesh.com/docs/10.0.0/guides/ingress/http/external-svc/#using-external-ip

https://kubernetes.io/docs/concepts/services-networking/service/#headless-services

https://link.medium.com/O66JLckTmub

https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/

.spec.clusterIP must be "None"

```to collect data to improve your experience on our site, as described in our Privacy Policy.

You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here. New to Voyager? Please start here.

Using External Service as Ingress Backend You can use an external service as a Backend for Kubernetes Ingress. There are 2 options depending on whether the external service has an external IP or DNS record.

Using External IP You can introduce any external IP address as a Kubernetes service by creating a matching Service and Endpoint object. Then you can use this service as a backend for your Ingress rules.

apiVersion: v1 kind: Service metadata:

 name: external-ip

spec:

 ports:
 - name: app
   port: 80
   protocol: TCP
   targetPort: 9855
 clusterIP: None

type: ClusterIP

apiVersion: v1 kind: Endpoints metadata:

 name: external-ip

subsets: - addresses:

 # list all external ips for this service
 - ip: 172.17.0.5
 ports:
 - name: app
   port: 9855
   protocol: TCP

Now, you can use this external-ip Service as a backend in your Ingress definition. For example:

apiVersion: voyager.appscode.com/v1beta1 kind: Ingress metadata:

 name: test-ings-rhvulnlb
 namespace: test-x

spec:

 backend:
   serviceName: external-ip
   servicePort: "80"
<br />

Subdir exact

apiVersion: networking.k8s.io/v1 kind: Ingress metadata:

 name: monitor-utils-subdir
 annotations:
   # nginx.ingress.kubernetes.io/configuration-snippet: |
   #   if ( $arg_proxyToken != "hytokentext" ) {
   #     return 401 'Unauthorized proxy token!';
   #   }
   nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
   nginx.ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/8
   nginx.ingress.kubernetes.io/rewrite-target: /$2

spec:

 ingressClassName: nginx
 tls:
 - hosts:
   - monitor.mktp.io
   secretName: tls-monitor-example-com
 rules:
   - host: monitor.example-com
     http:
       paths:
         - path: /monitor-utils(/|$)(.*)
         # - path: /monitor-utils/
           pathType: Exact
           backend:
             service:
               name: monitor-utils
               port:
                 number: 8080

```