SAP BTP, Kyma runtime is used to develop applications and extensions. The development process requires:
- Serving static content
- Authenticating and authorizing users
- Forwarding to the appropriate identity provider for logging in
- Rewriting URLs
- Dispatching requests to other microservices while propagating user information
All these and more capabilities are provided by SAP Application Router.
You can use the application router capabilities in SAP BTP, Kyma runtime either as:
- Managed Application Router, or
- Standalone Application Router deployed on SAP BTP, Kyma runtime
For more information on both options, see the Using SAP Application Router with Kyma runtime blog post.
This sample shows how to deploy a standalone Application Router on SAP BTP, Kyma runtime.
In this scenario, you deploy an application router and expose it over the internet using an APIRule custom resource. The APIRule exposes a backend API using configured destinations and routes.
The backend is a simple HttpBin application that returns request headers as a response.
Note
A standalone application router is deployed with 2 replicas. To achieve session affinity, you must configure the DestinationRule. Session affinity allows all subsequent traffic and requests from an initial client session to be passed to the same replica.
-
Export environment variables:
export NS={your-namespace} -
Create a namespace and enable istio-injection, if not done yet:
kubectl create namespace ${NS} kubectl label namespaces ${NS} istio-injection=enabled
-
Deploy the backend service:
kubectl -n ${NS} apply -f k8s/httpbin.yaml -
Create the XSUAA instance. Update the service instance definition. Replace {CLUSTER_DOMAIN} with the domain of your cluster.
kubectl -n ${NS} apply -f k8s/xsuaa-service-instance.yaml -
Create the destinations and routes configurations for the application router:
kubectl -n ${NS} apply -f k8s/config.yaml -
Deploy the application router:
kubectl -n ${NS} apply -f k8s/deployment.yaml -
Expose the application router using APIRule:
kubectl -n ${NS} apply -f k8s/api-rule.yaml
The application router is exposed at https://my-approuter.{CLUSTER_DOMAIN}. Access the URL https://my-approuter.{CLUSTER_DOMAIN}/sap/com/httpbin/headers to get all the request headers.