// Module included in the following assemblies:
//
// assembly-installing-manual-steps.adoc

[id='deploying-api-server-{context}']
= Deploying the API server

The API server provides a REST API for creating address spaces and addresses. It can also serve as an aggregated API server if it is registered as an API service.

.Procedure

. (Optional) Replace namespace if you want to deploy to something other than `{ProductNamespace}` (and substitute `{ProductNamespace}` in subsequent steps):
+
[options="nowrap",subs="+quotes,attributes"]
----
sed -i 's/{ProductNamespace}/_my-namespace_/' install/components/api-service/\*.yaml
sed -i 's/{ProductNamespace}/_my-namespace_/' install/components/api-server/*.yaml
----

. Register API service
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/components/api-service
----

ifeval::["{cmdcli}" == "kubectl"]
. Create a certificate to use with the API server. For testing purposes, you can create a self-signed certificate:
+
[options="nowrap",subs="+quotes,attributes"]
----
mkdir -p api-server-cert/
openssl req -new -x509 -batch -nodes -days 11000 -subj "/O=io.enmasse/CN=api-server._{ProductNamespace}_.svc.cluster.local" -out api-server-cert/tls.crt -keyout api-server-cert/tls.key
----

. Create a secret containing the API server certificate:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} create secret tls api-server-cert --cert=api-server-cert/tls.crt --key=api-server-cert/tls.key
----
endif::[]

. Deploy the API Server
+
[options="nowrap",subs="attributes"]
----
{cmdcli} apply -f install/components/api-server/
----
