APM Server configuration for 8.x and future ES versions

We are using IaC approach for our Elastic configuration and we have all resources defined in YAML files. It is very important for us to have it this way. Our APM configuration looks as below:

apm.yaml:

apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
  name: apm-server
  namespace: mom
spec:
  version: 8.4.3
  count: 1
  config:
    logging.level: warning
    logging.metrics.enabled: false
    apm-server:
      kibana:
        path: /kibana
  elasticsearchRef:
    name: elasticsearch-cluster
  kibanaRef:
    name: kibana-cluster
  http:
    service:
      spec:
        type: NodePort
  podTemplate:
    metadata:
      annotations:
        co.elastic.logs/json.keys_under_root: "true"
        co.elastic.logs/json.add_error_key: "true"
        co.elastic.logs/json.message_key: "message"

We have also elasticsearch (version 8.4.3.), fleet server (version: 8.4.3), elastic agent (version 8.4.3) and APM integration defined in kibana.yaml (kibana version is also 8.4.3):

x

    xpack.fleet.packages:
      - name: apm
        version: 8.4.2
.
.
    xpack.fleet.agentPolicies:
      - name: Elastic Agent on ECK policy
        id: eck-agent
        monitoring_enabled:
          - logs
          - metrics
        unenroll_timeout: 900
        is_default: true
        package_policies:
          - name: apm-1
            id: apm-1
            package:
              name: apm
            namespace: mom

With this setup everything works well and we don't need any changes, however in official documentation (eg. Components and documentation | APM User Guide [8.5] | Elastic), we have found information that APM standalone server is to be deprecated and the installation guide (here: Quick start | APM User Guide [8.5] | Elastic) only mentions installation of APM Agents, which is surprising as we don't find any way of running APM java agents without APM server.

My question is: will this setup be actually deprecated? If so, how can we change it to current version and install APM java agent without having defined APM server?

The new APM-Server is installed via Fleet into an Elastic Agent via the APM Integration. This is described in Step1-3 in the Quick Start Guide.

So you need a function Fleet Installation (Step 1). Then you have to add the APM-Integration to a policy for an Elastic Agent (Step 2). And Step 3 describes how to then install an Elastic Agent with this policy so that the APM-Server is installed via this Elastic Agent (on the Server where the Elastic Agent is running).

No Idea if you can get this in an IaC script.

@natbronislavska welcome to the forum!

My question is: will this setup be actually deprecated?

At the moment there are no concrete plans to deprecate the standalone (aka "legacy") APM Server -- you can safely continue using it.

If so, how can we change it to current version and install APM java agent without having defined APM server?

As @Shaoranlaos mentions above, you can use Elastic Agent and Fleet.

For something similar to what you're doing, here's an example of using ECK to set up APM Server as a Fleet-managed Elastic Agent integration: Configuration Examples | Elastic Cloud on Kubernetes [2.5] | Elastic