| title | Deploy a Self-Hosted Gateway to Kubernetes with YAML |
|---|---|
| description | Learn how to deploy a self-hosted gateway component of Azure API Management to Kubernetes with YAML. |
| author | dlepow |
| manager | gwallace |
| ms.service | azure-api-management |
| ms.topic | how-to |
| ms.author | danlep |
| ms.date | 10/08/2025 |
[!INCLUDE api-management-availability-premium-dev]
This article describes the steps for deploying the self-hosted gateway component of Azure API Management to a Kubernetes cluster.
Note
You can also deploy self-hosted gateway to an Azure Arc-enabled Kubernetes cluster as a cluster extension.
-
Complete the following quickstart: Create an Azure API Management instance.
-
Create a Kubernetes cluster, or have access to an existing one.
[!TIP] Single-node clusters work well for development and evaluation purposes. Use Kubernetes Certified multi-node clusters on-premises or in the cloud for production workloads
-
Provision a self-hosted gateway resource in your API Management instance.
[!INCLUDE api-management-self-hosted-gateway-authentication]
- Select Gateways under Deployment and infrastructure.
- Select the self-hosted gateway resource that you want to deploy.
- Select Deployment.
- An access token in the Token text box was autogenerated for you, based on the default Expiry and Secret key values. If needed, choose values in either or both controls to generate a new token.
- Select the Kubernetes tab under Deployment scripts.
- Select the <gateway-name>.yml file link and download the YAML file.
- Select the copy icon at the lower-right corner of the Deploy text box to save the
kubectlcommands to the clipboard. - When using Azure Kubernetes Service (AKS), run
az aks get-credentials --resource-group <resource-group-name> --name <resource-name> --adminin a new terminal session. - Run the commands to create the necessary Kubernetes objects in the default namespace and start self-hosted gateway pods from the container image downloaded from the Microsoft Artifact Registry.
- The first step creates a Kubernetes secret that contains the access token generated in step 4. Next, it creates a Kubernetes deployment for the self-hosted gateway, which uses a ConfigMap with the configuration of the gateway.
[!INCLUDE api-management-self-hosted-gateway-kubernetes-services]
- To learn more about the self-hosted gateway, see Self-hosted gateway overview.
- Learn how to deploy API Management self-hosted gateway to Azure Arc-enabled Kubernetes clusters.
- Learn more about guidance for running the self-hosted gateway on Kubernetes in production.