> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-Region Apinizer

> Can explain step by step how Apinizer works on multi-region Kubernetes architecture. Provides installation and configuration of Apinizer components in Kubernetes clusters in different geographical regions. Provides necessary steps and configuration details for multi-region installation.

<Note>
  This document only describes **operations specific to Apinizer that need to be done**. Details about Kubernetes cluster and Apinizer installation are not within the scope of this document and are presented in a separate document.
</Note>

<CardGroup cols={2}>
  <Card title="Kubernetes Installation" icon="layer-group" href="/en/setup/kubernetes/kubernetes">
    Learn Kubernetes cluster installation
  </Card>

  <Card title="Apinizer Installation" icon="server" href="/en/setup/apinizer/apinizer">
    Learn Apinizer installation
  </Card>
</CardGroup>

## Disabling Kubernetes Namespace and Resource Management Feature

In multi-region installation, the Kubernetes namespace and resource management feature through Apinizer Manager Console must be disabled.

When the **"Enable the management of Kubernetes Namespace and Resources with Apinizer"** setting is disabled in the Apinizer interface, Apinizer no longer automatically creates or updates namespaces and resources on Kubernetes.

In this case:

* Management of Kubernetes resources (Deployment, Service, Secret, Role, etc.) must be performed **manually through YAML files**.
* This method provides more flexibility and control in multi-cluster structures and facilitates Multi Region installation.

<Steps>
  <Step title="Go to Administration menu">
    Open the Administration menu in Apinizer Manager Console.
  </Step>

  <Step title="Open System Settings → General Settings tab">
    Go to General Settings tab under System Settings.
  </Step>

  <Step title="Disable Kubernetes management">
    Disable (disable) the "Enable the management of Kubernetes Namespace and Resources with Apinizer" option.
  </Step>

  <Step title="Save changes">
    Save the changes made.
  </Step>
</Steps>

<Frame caption="Kubernetes Namespace and Resource Management setting - General Settings page">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/multi-region/01-kubernetes-namespace-ayari.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=51b59fb2ec4ef68aa0d98dc3f4e2f3ea" alt="Kubernetes Namespace and Resource Management Setting" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/multi-region/01-kubernetes-namespace-ayari.png" />
</Frame>

## Environment Creation

Environment is created through Apinizer Manager Console for multi-region configuration. With this operation, information about which environment (namespace) and which clusters Apinizer should access and manage is defined.

For example, you can define a new environment we installed in a different region to the cluster of an existing environment named prod with the following steps.

<Steps>
  <Step title="Go to Gateway Environments page">
    Open **Administration > Server Management > Gateway Environments** page.

    <Frame caption="Gateway Runtimes page - Multi-region environment configuration">
      <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/multi-region/02-gateway-environments.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=a5bd274c57899b06ba9514c8eb834a34" alt="Gateway Runtimes Page" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/multi-region/02-gateway-environments.png" />
    </Frame>
  </Step>

  <Step title="Define Gateway and Cache Management API Access URLs">
    In the **Gateway and Cache Management API Access URLs** section, define the management API access information of **Gateway** and **Cache** components belonging to the newly added cluster.

    <Warning>
      **Very Important**

      In this step, **accessible Gateway and Cache addresses** by Apinizer Manager Console must be entered for each cluster.
    </Warning>

    <Frame caption="Gateway and Cache Management API Access URLs - Cluster access information">
      <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/multi-region/03-gateway-cache-api-access.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=640ce44f505c2bdb23925f0720e6285c" alt="Gateway and Cache Management API Access URLs" width="1200" height="600" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/multi-region/03-gateway-cache-api-access.png" />
    </Frame>
  </Step>

  <Step title="Test access and save">
    Test that access is provided using the "Try it" button. If access is successful, save.

    <Frame caption="Access test with Try it button - Connection verification">
      <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/multi-region/04-try-it-test.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=3464692087cb615c9b447d9581d61a9a" alt="Access Test with Try it Button" width="1200" height="700" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/multi-region/04-try-it-test.png" />
    </Frame>
  </Step>
</Steps>

## Adding Cluster Information to YAML Files

To specify which cluster Apinizer Worker and Cache applications running in the same environment (namespace) but in different geographical environments belong to, the following setting must be made. With this setting, which cache each worker will connect to is also determined.

The following environment variable must be added to each **Worker Deployment** definition:

```yaml theme={null}
spec:
  containers:
    env:
      - name: environmentClusterName
        value: <NAME>
```

<Warning>
  **Very Important**

  * `<NAME>` is the name representing the cluster where the Cache that the Worker will connect to is located.
  * This name must be exactly the same as the cluster name defined under **Gateway Environments** in the Apinizer interface.
  * Each Worker component in each cluster only communicates with the Cache component located in its own region.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Apinizer Installation" icon="server" href="/en/setup/apinizer/apinizer">
    Learn Apinizer installation
  </Card>

  <Card title="API Portal Installation" icon="window-maximize" href="/en/setup/apinizer/api-portal">
    Learn API Portal installation
  </Card>

  <Card title="API Integration Installation" icon="plug" href="/en/setup/apinizer/api-integration">
    Learn API Integration installation
  </Card>

  <Card title="Kubernetes Installation" icon="layer-group" href="/en/setup/kubernetes/kubernetes">
    Learn Kubernetes installation
  </Card>
</CardGroup>
