Cloud Foundry and Kyma Environments

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

When you have written an application, somebody has to run it: start it, give it a web address, restart it when it fails and give it access to a database. SAP Business Technology Platform (SAP BTP) offers two main places to do this for the applications that this site builds. In the Cloud Foundry environment you hand SAP your code and a short description, and the platform builds and runs it for you. In the Kyma environment you package the code yourself as a container image and describe the running application in Kubernetes terms, on a cluster that SAP manages. This page explains both in plain words, shows how a Cloud Foundry application is pushed with a manifest, and how a workload is declared and exposed in Kyma with a Kubernetes Deployment and a Kyma APIRule. SAP BTP remains the documented name of the platform, and SAP now presents its capabilities as part of SAP Business AI Platform. The page applies to the SAP BTP documentation as read on 2026-11-13 and to CAP Node.js 10.2 (@sap/cds 10.2.2, Node.js 22.12 or newer) and CAP Java 5.2 (Java 21 or newer, 25 recommended). Every command and file in the listings needs an SAP BTP account, so nothing on this page was run; the listings are labeled and each one cites the official page it follows.

Before you read

Key terms

  • Cloud Foundry environment: the environment of a subaccount in which SAP runs the open-source Cloud Foundry application platform for you.

  • Kyma environment: the environment of a subaccount that provides managed Kubernetes clusters based on the open-source project Kyma.

  • Buildpack: a bundle of the languages, libraries and services that an application needs, which Cloud Foundry combines with your code into something it can run.

  • Gardener: the open-source project on which the Kubernetes clusters of a Kyma environment are created.

  • Role-based access control (RBAC): the Kubernetes way of deciding what a user may do by assigning roles to users or groups.

  • APIRule: a Kyma custom resource that publishes a Kubernetes Service under a host name and says which paths, methods and access strategy apply.

Two runtimes in one subaccount

A subaccount can hold several environments, and SAP’s own description says that an environment brings the tools, technologies and runtimes needed to build applications. The advantage of using different environments in one subaccount is that users, authorizations and entitlements are managed once per subaccount. To use an environment you enable it, which creates an instance of that environment. SAP lists three ways to do that: the Enable button on the subaccount overview of the cockpit, the Service Marketplace in the cockpit, and the btp command btp create accounts/environment-instance.

The environments page also names two others that this page does not cover. The ABAP environment is for extensions of ABAP-based products such as SAP S/4HANA Cloud. The Neo environment is the older platform for HTML5, Java and SAP HANA extended application services applications, and SAP notes that the multi-environment subaccount does not apply to it.

Question Cloud Foundry environment Kyma environment

What is it?

The Cloud Foundry runtime on SAP platform: an open-source application platform managed by the Cloud Foundry Foundation, run by SAP.

Kyma runtime on SAP platform: a fully managed cloud-native Kubernetes application runtime based on the open-source project Kyma.

What do you deliver?

Your application files and, usually, a manifest. A buildpack turns them into a runnable application.

A container image that you build yourself, and Kubernetes resources (such as a Deployment) that describe how it runs.

Who builds the runtime image?

The platform, with a buildpack, when you push.

You or your pipeline. CAP’s Kyma guide says that SAP BTP does not provide a container image registry, so you choose one.

How is it divided?

An org with spaces.

One or more Kubernetes clusters with namespaces.

Who may do what?

Cloud Foundry roles in the org and space.

Kubernetes RBAC inside the cluster.

For Example Trading Co. (EX01) the partner dashboard application that the CAP pages of this section build can run in either environment. The rest of the page follows the same small application, called partner-dashboard here, through both. The names partner-dashboard, ex01-partner-db and ex01-partner-xsuaa in the listings are teaching names that this page defines.

flowchart LR S["Your CAP project"] -- "cf push or cds up" --> C["Cloud Foundry: buildpack stages a droplet"] S -- "build image, then helm or kubectl" --> K["Kyma: image runs as a pod"] C --> R1["Route: org-space host name"] K --> R2["APIRule: host name on the Kyma gateway"]

The Cloud Foundry environment

SAP describes the Cloud Foundry environment as the place to create polyglot cloud applications. It supports multiple runtimes, programming languages, libraries and services, and SAP says you can use a multitude of buildpacks, including community and self-developed ones. It integrates with SAP HANA extended application services, advanced model. For everything that is not specific to SAP, SAP points to the official Cloud Foundry documentation.

What happens when you push an application

The Cloud Foundry documentation describes the journey of an application in four steps. Your source code is packaged with its stack and buildpack. The Cloud Controller stages the application, which means that it combines stack, buildpack and source code into a droplet that a virtual machine can unpack and run. A component called Diego then distributes the application instances across the host machines. Finally the Gorouter sends incoming traffic to the machines that run the application. The stack is the operating system that the application runs on.

A buildpack is the part that knows your language. The documentation lists classic buildpacks for Binary, Go, Hosted Web Core, Java, .NET Core, NGINX, Node.js, PHP, Python, R, Ruby and Staticfile, and says that Cloud Foundry supports two types of buildpacks: classic buildpacks and Cloud Native Buildpacks, with Paketo as the Cloud Native option. For the Node.js buildpack the documentation says that it is selected automatically when the root directory of the project contains a package.json file, and that the Node.js version is taken from the engines.node entry of that file. A CAP Node.js project already declares such an entry (>=22.12 in the lab of this site), so the buildpack picks a matching Node.js version; if the requested version is not supported, staging fails. For Java the documentation lists a Java buildpack, and CAP’s guide mentions that the Java buildpack extracts the JAR file of a CAP Java application.

Logging on and choosing a target

Before a push you tell the cf command line client which Cloud Foundry installation to talk to and who you are. SAP’s logon page gives the first two steps. The next listing shows them, with the region eu10 that SAP uses in its own example, and the third command, which CAP’s deployment guide uses to log on with an SAP Universal ID. It requires an SAP BTP account; not run here.

cf api https://api.cf.eu10.hana.ondemand.com

cf login

cf login --sso

cf target -o <org> -s <space>

cf api sets the API endpoint of the Cloud Controller. SAP states that trial and enterprise accounts use the same endpoints, and lists the endpoint of every region on its page about regions and API endpoints; the endpoint of a region follows the pattern api.cf.<region>.hana.ondemand.com for the Amazon Web Services regions that were opened for this page. cf login asks for your credentials; SAP says the default identity provider is the SAP ID service, and the option --origin selects another provider. cf login --sso is the single sign-on variant that CAP’s guide uses. cf target sets or shows the org and the space; its usage line is cf target [-o ORG] [-s SPACE]. After these commands every push goes into that space.

The manifest and cf push

cf push APP-NAME pushes an application with default settings. The Cloud Foundry documentation says that the default route is made of the application name, with underscores turned into hyphens, as the host name, plus the default apps domain of the installation. A file called manifest.yml in the working directory lets you write the settings down instead of repeating flags: it can hold the application name, so that cf push works without arguments, the instance count, the memory and disk limits, a start command and the services to bind. A flag on the command line overrides the manifest, and the option -f points to a manifest in another place.

The next listing is a manifest for the partner dashboard. Its path points to the folder that CAP’s production build generates for the server, gen/srv, as used for the Kyma image in the same guide. The two service instances must already exist in the space before the push, because the documentation says an application can only bind to service instances that exist in the target space before it is deployed. The listing requires an SAP BTP account; not run here.

---
applications:
- name: partner-dashboard
  path: gen/srv
  memory: 512M
  instances: 2
  random-route: true
  command: npm start
  services:
    - ex01-partner-db
    - ex01-partner-xsuaa

Reading the listing line by line: name is the application name; memory is the memory limit for every instance and accepts the units M, MB, G or GB; instances is the instance count, and the Cloud Foundry documentation recommends at least two so that platform maintenance does not interrupt the application; random-route: true generates a unique host name to avoid name collisions; command sets a custom start command, here the start script of the project (cds-serve in the lab of this site); and services lists the service instances to bind. Bound services reach the application through the environment variable VCAP_SERVICES, a JSON document that holds the credentials, the plan and the tags of each binding; Cloud Foundry adds it when you restart the application after binding. The application must listen on the port given in the variable PORT, which Cloud Foundry allocates for each instance, and the CAP Node.js server reads that variable. The manifest also has an env attribute for plain environment variables, but the documentation warns against putting credentials there and recommends user-provided service instances instead.

The command that pushes is then run in the folder that holds the manifest.

cf push

Source: Pushing an App

The documentation says that by default a push to a running application stops all existing instances, so users may see a 404 Not Found during the push, and names rolling and blue-green deployments as ways to avoid that.

How CAP projects usually reach Cloud Foundry

A CAP project normally does not call cf push directly. CAP’s deployment guide for Cloud Foundry prepares the project with cds add hana, cds add xsuaa and cds add mta, which writes an mta.yaml deployment descriptor, and then runs cds up. According to the guide, cds up installs dependencies, builds the archive with mbt build -t gen --mtar mta.tar and deploys it with cf deploy gen/mta.tar -f. The guide’s prerequisites are an SAP HANA Cloud database running in the subaccount, the entitlement for the hdi-shared plan, a Cloud Foundry space, the Cloud MTA Build Tool and the Cloud Foundry command line client version 8 or higher with the multiapps plugin. The manifest above shows what a single push looks like; for a CAP project with a database, authentication and a user interface, follow SAP’s guide rather than writing the descriptor by hand.

The Kyma environment

A Kyma environment consists of two things, according to the Kyma environment page. The first is one or more Kubernetes clusters based on the open-source project Gardener, on a cloud provider and in a region that you choose. The second is a set of Kyma modules, picked by you in the release channel of your choice, installed on the cluster. SAP adds that Kyma is a managed service that checks all Kyma-managed resources, and that any unexpected modification is discarded and the resource reverted to its original state. It supports CAP, the SAP Cloud SDK, the application router and the HTML5 deployer out of the box. The cluster is provisioned for you when you create the environment instance in the cockpit. SAP’s concepts page adds that to access the cluster you must have appropriate roles assigned.

Modules

A Kyma module is an extension that can be added, deleted or reconfigured at runtime, so you install only what you need. When you create the runtime in the cockpit it comes with three default modules, which you may delete if you do not need them.

Module Technical name Purpose

Istio

istio

A service mesh with Kyma-specific configuration.

API Gateway

api-gateway

Functions to expose and secure APIs.

SAP BTP Operator

btp-operator

Installs the SAP BTP service operator, which lets you consume SAP BTP services from the cluster with Kubernetes-native tools.

Optional modules include Serverless, Eventing, Telemetry, Keda and NATS. The page also lists two modules from other SAP teams, the Transparent Proxy and the Connectivity Proxy, the second for on-premise systems exposed through the Cloud Connector. A module release reaches the fast channel first and the regular channel after about two weeks.

Source: Kyma Modules

Getting access and the RBAC model

You can work with the cluster in the Kyma dashboard or with kubectl. For kubectl, SAP’s page gives these steps: install the kubectl plugin oidc-login, download kubeconfig.yaml from the KubeconfigURL link in the Kyma Environment section of the subaccount overview, and point the environment variable KUBECONFIG at that file. That is a setup step on your machine and needs an existing Kyma instance.

Access control inside Kyma is Kubernetes role-based access control, not SAP BTP role collections. SAP’s page states that Kyma uses the standard Kubernetes ClusterRoles view, edit, admin and cluster-admin; that the user who creates the cluster is bound to cluster-admin automatically; and that roles are assigned through a RoleBinding (scoped to one namespace) or a ClusterRoleBinding (scoped to the whole cluster), managed in the Kyma dashboard or with kubectl. Assigning roles to groups instead of single users needs a custom identity provider, because the default shared SAP ID service tenant does not support group claims. SAP suggests separating operators, who manage the cluster, from developers, who work inside their namespaces. Kyma modules extend the view, edit and admin roles with their own permissions through ClusterRole aggregation, so a user in one of these roles gets the permissions of a newly installed module without further steps. The Kubernetes side of this model, including what a RoleBinding looks like, is explained in Authentication, Authorization and RBAC.

A workload and its APIRule

To run the partner dashboard in Kyma you need a container image in a registry that the cluster can reach. CAP’s guide builds the image with the pack command and Cloud Native Buildpacks, and its generated Helm chart (added with cds add kyma) deploys it. The listing below shows the same result written by hand, so that the objects are visible: a namespace label, a Deployment and a Service. It requires an SAP BTP account; not run here. The image name is a placeholder, and port 4004 is the port at which the CAP Node.js server listens when PORT is not set.

apiVersion: v1
kind: Namespace
metadata:
  name: ex01-partner
  labels:
    istio-injection: enabled
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: partner-dashboard
  namespace: ex01-partner
spec:
  replicas: 2
  selector:
    matchLabels:
      app: partner-dashboard
  template:
    metadata:
      labels:
        app: partner-dashboard
    spec:
      containers:
        - name: partner-dashboard
          image: <registry>/partner-dashboard:1.0.0
          ports:
            - containerPort: 4004
---
apiVersion: v1
kind: Service
metadata:
  name: partner-dashboard
  namespace: ex01-partner
spec:
  selector:
    app: partner-dashboard
  ports:
    - name: http
      port: 4004
      targetPort: 4004

Source: Expose a Workload with noAuth (namespace label and Deployment/Service shape), cds-server (port 4004) and Deploy to Kyma (CAP)

The label istio-injection: enabled on the namespace turns on the Istio sidecar proxy injection; the Kyma tutorial creates its test namespace the same way with kubectl label namespace. The reason matters for the next step: the API Gateway documentation says that to expose a workload with an APIRule in version v2, the workload must be part of the Istio service mesh. How a Deployment keeps the requested number of pods running, and how a Service gives them one stable address, is explained in ReplicaSets and Deployments and Services.

Nothing above is reachable from outside the cluster yet. An APIRule publishes the Service. The API Gateway module watches APIRules and turns them into Istio configuration, such as VirtualService and AuthorizationPolicy objects, so you do not write those yourself. The current version of the resource is gateway.kyma-project.io/v2, which is the only version listed in the API reference. The listing shows an APIRule that publishes the partner dashboard behind JSON Web Token validation. The default gateway of a Kyma cluster is kyma-system/kyma-gateway, and the host is the dashboard’s short name with the cluster domain; <cluster-domain>, <issuer> and <jwks-uri> are placeholders for your cluster’s domain and your identity provider’s values. It requires an SAP BTP account; not run here.

apiVersion: gateway.kyma-project.io/v2
kind: APIRule
metadata:
  name: partner-dashboard
  namespace: ex01-partner
spec:
  gateway: kyma-system/kyma-gateway
  hosts:
    - partner-dashboard.<cluster-domain>
  service:
    name: partner-dashboard
    namespace: ex01-partner
    port: 4004
  rules:
    - path: /{**}
      methods: ["GET", "POST"]
      jwt:
        authentications:
          - issuer: <issuer>
            jwksUri: <jwks-uri>

The fields, as the API reference defines them, are these. hosts is the external address for inbound traffic and may be a full domain name, a single short host name, or a wildcard such as *.example.com; a single-label host takes its domain from the referenced gateway. gateway names the Istio gateway in the form namespace/gateway. service is the backend Service with name, namespace and a port from 1 to 65535; if it is left out, every rule must define its own service. rules is an ordered list with at least one item, and earlier rules take priority over later ones. Each rule has a path (exact, using the operators {*} or {**}, or /*), a list of methods, and exactly one access strategy: jwt, extAuth or noAuth. A timeout can be set for all rules, from 1 to 3900 seconds, and a rule can override it. The reference’s own sample uses noAuth: true, and the Kyma tutorial warns that exposing a workload without authentication is a potential security vulnerability in production; SAP’s API Gateway documentation recommends the jwt strategy for most common scenarios, which is why the listing uses it. After applying the resource you can read its state with kubectl get apirules partner-dashboard -n ex01-partner, as the tutorial does for its own rule.

How CAP projects reach Kyma

CAP’s guide for Kyma mirrors the Cloud Foundry one. After cds add hana,xsuaa it adds a configurable Helm chart with cds add kyma, which asks for the cluster domain and the container registry name, and a single command, cds up -2 k8s, with the optional -n <your-namespace>, builds the images with pack, pushes them and installs the chart with helm upgrade --install. The guide’s prerequisites are a Kyma cluster, a container registry, Docker, kubectl, pack and helm, an SAP HANA Cloud database mapped to the namespace, and SAP HANA Cloud being reachable from the cluster by trusted source IP configuration. The guide states that the Docker daemon must be running first.

Choosing between them

Both environments can run the same CAP application, so the choice is about who does which work. In Cloud Foundry the platform stages the application, so a team that wants the shortest path from code to a running application and that is happy with buildpack-supported runtimes finds the manifest and cf push enough. In Kyma the team owns the image and the Kubernetes description, and gets in return the Kubernetes vocabulary of Deployments, namespaces and RBAC and the module system, which suits teams that already work with Kubernetes. CAP’s guide says SAP BTP does not provide an image registry, so a registry is one more thing to arrange for Kyma. The account model shows that the Cloud Foundry environment is available by default in a subaccount and that Kyma must be assigned as an entitlement first.

Summary

  • An environment is a runtime that you enable in a subaccount; this page covers Cloud Foundry (an org with spaces) and Kyma (clusters with namespaces).

  • In Cloud Foundry you log on with cf api and cf login, choose the org and space with cf target, describe the application in a manifest.yml and run cf push; a buildpack stages it into a droplet.

  • CAP projects usually reach Cloud Foundry through cds add mta and cds up, and Kyma through cds add kyma and cds up -2 k8s.

  • A Kyma environment is a Gardener-based Kubernetes cluster plus modules; access is Kubernetes RBAC with the roles view, edit, admin and cluster-admin, not BTP role collections.

  • A workload in Kyma is a Deployment and a Service; an APIRule of version gateway.kyma-project.io/v2 publishes it, and that version needs the workload in the Istio mesh.

  • The CAP Node.js 10.2 and CAP Java 5.2 baseline applies to both environments, and all commands here need an SAP BTP account.