Edit

Share via


Deploy a self-hosted gateway to Kubernetes by using Helm

APPLIES TO: Developer | Premium

Helm is an open-source packaging tool that helps you install and manage the lifecycle of Kubernetes applications. Helm allows you to manage Kubernetes charts, which are packages of preconfigured Kubernetes resources.

This article explains how to deploy a self-hosted gateway component of Azure API Management to a Kubernetes cluster by using Helm.

Note

You can also deploy a self-hosted gateway to an Azure Arc-enabled Kubernetes cluster as a cluster extension.

Prerequisites

  • Create an Azure 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.

Add the Helm repository

  1. Add Azure API Management as a new Helm repository by using the following command.

    helm repo add azure-apim-gateway https://azure.github.io/api-management-self-hosted-gateway/helm-charts/
    
  2. Update the repo to fetch the latest Helm charts.

    helm repo update
    
  3. Verify your Helm configuration by listing all available charts.

    helm search repo azure-apim-gateway
    

    The following example shows the available charts.

    NAME                                            CHART VERSION   APP VERSION     DESCRIPTION
    azure-apim-gateway/azure-api-management-gateway 1.15.0           2.11.0           A Helm chart to deploy an Azure API Management ...
    

Deploy the self-hosted gateway to Kubernetes

Tip

The following steps deploy the self-hosted gateway to Kubernetes and enable authentication to the API Management instance by using a gateway access token (authentication key). You can also deploy the self-hosted gateway to Kubernetes and enable authentication to the API Management instance by using Microsoft Entra ID. For more information, see Self-hosted gateway authentication options.

  1. In the Azure portal, navigate to your API Management instance.

  2. Under Deployment and infrastructure in the sidebar menu, select Self-hosted gateways.

  3. Select the self-hosted gateway resource you intend to deploy.

  4. Select Deployment.

  5. A new token in the Token text box was autogenerated for you using the default Expiry and Secret Key values. Adjust either or both if desired, and select Generate to create a new token.

  6. Take note of your Token and Configuration URL.

  7. Install the self-hosted gateway by using the Helm chart.

    helm install azure-api-management-gateway \
                 --set gateway.configuration.uri='<your configuration url>' \
                 --set gateway.auth.key='<your token>' \
                 azure-apim-gateway/azure-api-management-gateway
    
  8. Execute the command. The command instructs your Kubernetes cluster to:

    • Download the image of the self-hosted gateway from the Microsoft Container Registry and run it as a container.
    • Configure the container to expose HTTP (8080) and HTTPS (8081) ports.

    Important

    By default, the gateway uses a ClusterIP service and is only exposed inside the cluster. You can change this by specifying the type of Kubernetes service during installation.

    For example, you can expose it through a load balancer by adding --set service.type=LoadBalancer