Deploy to Azure Kubernetes Service
This article provides the steps for deploying self-hosted gateway component of Azure API Management to Azure Kubernetes Service. For deploying self-hosted gateway to a Kubernetes cluster, see the how-to article.
- Create an Azure API Management instance
- Create an Azure Kubernetes cluster
- Provision a gateway resource in your API Management instance.
Deploy the self-hosted gateway to AKS
Select Gateways from under Deployment and infrastructure.
Select the self-hosted gateway resource you intend to deploy.
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.
Make sure Kubernetes is selected under Deployment scripts.
Select <gateway-name>.yml file link next to Deployment to download the file.
config.service.endpoint, port mappings, and container name in the .yml file as needed.
Depending on your scenario, you might need to change the service type.
- The default value is
LoadBalancer, which is the external load balancer.
- You can use the internal load balancer to restrict the access to the self-hosted gateway to only internal users.
- The sample below uses
- The default value is
Select the copy icon located at the right end of the Deploy text box to save the
kubectlcommand to clipboard.
Paste the command to the terminal (or command) window. The command expects the downloaded environment file to be present in the current directory.
kubectl apply -f <gateway-name>.yaml
Execute the command. The command instructs your AKS cluster to:
- Run the container, using self-hosted gateway's image downloaded from the Microsoft Container Registry.
- Configure the container to expose HTTP (8080) and HTTPS (443) ports.
Run the below command to check the gateway pod is running. Your pod name will be different.
kubectl get pods NAME READY STATUS RESTARTS AGE contoso-apim-gateway-59f5fb94c-s9stz 1/1 Running 0 1m
Run the below command to check the gateway service is running. Your service name and IP addresses will be different.
kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE contosogateway NodePort 10.110.230.87 <none> 80:32504/TCP,443:30043/TCP 1m
Return to the Azure portal and confirm that gateway node you deployed is reporting healthy status.
kubectl logs <gateway-pod-name> command to view a snapshot of self-hosted gateway log.
- To learn more about the self-hosted gateway, see Azure API Management self-hosted gateway overview.
- Learn how to deploy API Management self-hosted gateway to Azure Arc-enabled Kubernetes clusters.
- Learn more about Azure Kubernetes Service.
- Learn how to configure and persist logs in the cloud.
- Learn how to configure and persist logs locally.