SAP BTP, Kyma runtime is used to develop applications and extensions.
This also brings in the following requirements:
- Serve static content
- Authenticate and authorize users
- Forward to the appropriate identity provider for login
- Rewrite URLs
- Dispatch requests to other microservices while propagating user information
All these and more capabilities are provided by SAP Application Router.
There are two options to use the Application Router capabilities in SAP BTP, Kyma runtime.
- Managed Application Router
- Standalone Application Router deployed on SAP BTP, Kyma runtime.
You can learn about both options in this blog
In this sample, we will deploy a Standalone Application Router deployed on SAP BTP, Kyma runtime.
We will deploy an approuter, expose it over the internet via APIRule. It will be exposing a backend API via its configured destinations and routes.
As a simple backend, we will use an HttpBin application that returns the request headers as a response. Good for understanding flows and troubleshooting.
Note: Standalone approuter is deployed with 2 replicas. Session stickiness is achieved by configuring the Destination rule
- Export environment variables
export NS={your-namespace}
- Create the namespace and enable istio-injection if not already done.
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 approuter
kubectl -n ${NS} apply -f k8s/config.yaml
- Deploy the approuter
kubectl -n ${NS} apply -f k8s/deployment.yaml
- Expose the approuter via APIRule.
kubectl -n ${NS} apply -f k8s/api-rule.yaml
The approuter 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