<a id="cmf-create-apps"></a>

# Create Confluent Manager for Apache Flink Applications

A CMF application is a deployed Apache Flink® job managed through a JSON or YAML
specification.
To create an application, you specify details of the application in a JSON or YAML file.
Then use the Confluent CLI or REST API to create the application, passing the file as an argument.

Flink applications are deployed in Confluent Platform with Confluent Manager for Apache Flink (CMF), which is a
central management component of Confluent Platform for Apache Flink. CMF enables you to manage a fleet of Flink jobs, either applications or SQL statements,
across multiple environments.

The following sections describe the specification format, creation methods, and response structure.

<a id="cmf-create-apps-spec"></a>

## Application specification format

The following JSON and YAML examples show equivalent application specifications.

### JSON

```json
{
  "apiVersion": "cmf.confluent.io/v1",
  "kind": "FlinkApplication",
  "metadata": {
    "name": "app-1"
  },
  "spec": {
    "image": "confluentinc/cp-flink:1.19.3-cp1",
    "flinkVersion": "v1_19",
    "flinkConfiguration": {
      "taskmanager.numberOfTaskSlots": "1"
    },
    "serviceAccount": "flink",
    "jobManager": {
      "resource": {
        "memory": "1024m",
        "cpu": 1
      }
    },
    "taskManager": {
      "resource": {
        "memory": "1024m",
        "cpu": 1
      }
    },
    "job": {
      "jarURI": "local:///opt/flink/examples/streaming/StateMachineExample.jar",
      "state": "running",
      "parallelism": 1,
      "upgradeMode": "stateless"
    }
  }
}
```

### YAML

```yaml
apiVersion: cmf.confluent.io/v1
kind: FlinkApplication
metadata:
  name: app-1
spec:
  image: confluentinc/cp-flink:1.19.3-cp1
  flinkVersion: v1_19
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "1"
  serviceAccount: flink
  jobManager:
    resource:
      memory: 1024m
      cpu: 1
  taskManager:
    resource:
      memory: 1024m
      cpu: 1
  job:
    jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
    state: running
    parallelism: 1
    upgradeMode: stateless
```

The application specification includes the following fields:

* `image`: The name of the Docker image that is used to start the Flink cluster. CMF expects this image to be a
  [Confluent Platform Flink image](https://hub.docker.com/r/confluentinc/cp-flink) or to be derived from a
  Confluent Platform Flink image.
* `flinkVersion`: The Flink version corresponding to the Flink version of the Docker image.
* `flinkConfiguration`: A map of Flink configuration parameters. Before the configuration is passed to the Flink cluster,
  it is merged with the Environment’s default configuration for applications. The Flink configuration is used to configure
  cluster and job behavior, such as checkpointing, security, logging, and more.
  For more on Flink job configuration, see [Configure Flink Jobs in Confluent Manager for Apache Flink](../configure/overview.md#cmf-configure).
* `serviceAccount`: The name of the Kubernetes service account that is used to start and run the application’s Flink cluster.
* `jobManager` & `taskManager`: The Kubernetes specification of the Flink Job Manager and Task Manager pods.
* `job.jarURI`: The path to the Flink job JAR file. To learn how to package Flink jobs and make the job JAR available to the cluster,
  see [Package Flink Jobs](packaging.md#cmf-package). When
  [artifact management](../../configure/artifacts.md#cmf-artifacts) is enabled, this field also accepts
  a `cmf://{environment}/{artifact-name}[?version={N}]` reference to an
  artifact uploaded to CMF.
* `job.state`: The desired state of the application. Can be `running` or `suspended`.
* `job.parallelism`: The desired execution parallelism of the application.
  Can be adapted to rescale the application.

## Create the application

Use the REST API or the Confluent CLI to create the application.
The following sections show examples of how to do this with a JSON file named `app-1.json` created
using the `app-1.json` specification from the [Specification](#cmf-create-apps-spec) section.

### REST API

You can create the application using the REST API by passing the JSON file as an argument.

```bash
curl -v -H "Content-Type: application/json" \
-X POST http://cmf:8080/cmf/api/v1/environments/env-1/applications \
-d @/path/to/app-1.json
```

### Confluent CLI

You can create the application using the Confluent CLI, passing the JSON file as an argument.

```bash
confluent --environment env-1 \
flink application create /path/to/app-1.json
```

## Application response

The response returns the submitted application specification with added metadata fields
such as `creationTimestamp` and `updateTimestamp`, and a status object.
After receiving the response, CMF creates a Flink Deployment and submits it for execution.

The response to an application creation request specifying a JSON file could look like the following:

```json
{
   "apiVersion": "cmf.confluent.io/v1",
   "kind": "FlinkApplication",
   "metadata": {
     "creationTimestamp": "2025-08-27T12:30:23.616863679Z",
     "name": "app-1",
     "updateTimestamp": "2025-08-27T12:30:23.616865470Z"
   },
   "spec": {
     "flinkConfiguration": {
       "taskmanager.numberOfTaskSlots": "1"
     },
     "flinkVersion": "v1_19",
     "image": "confluentinc/cp-flink:1.19.3-cp1",
     "job": {
       "jarURI": "local:///opt/flink/examples/streaming/StateMachineExample.jar",
       "parallelism": 1,
       "state": "running",
       "upgradeMode": "stateless"
     },
     "jobManager": {
       "resource": {
         "cpu": 1,
         "memory": "1024m"
       }
     },
     "serviceAccount": "flink",
     "taskManager": {
       "resource": {
         "cpu": 1,
         "memory": "1024m"
       }
     }
   },
   "status": {
     "jobStatus": {
       "jobName": "",
       "state": ""
     }
   }
 }
```

## Related content

- [Application Instances in Confluent Manager for Apache Flink](application-instances.md#cmf-application-instances)
- [Describe, Update and Delete Confluent Manager for Apache Flink Applications](manage.md#cmf-manage-apps)
