Deploy with API7 Ingress Controller on Kubernetes
This tutorial will show you how to deploy API7 gateway and ingress controller on Kubernetes. API7 Ingress Controller allows you to configure API7 Gateway declaratively in Kubernetes. If you do not wish to work with Kubernetes and API7 Ingress Controller, you may skip this tutorial and start with Launch Your First API.
Prerequisites
- Install API7 Enterprise.
- Have a running Kubernetes cluster.
- Have kubectl installed.
Create and Set Namespace
You can optionally create a new namespace for the resources and set it as the preferred namespace, so that you do not need explicitly specify the namespace in every command.
Create a new namespace api7
and set it as the preferred namespace:
kubectl create namespace api7 && \
kubectl config set-context --current --namespace=api7
To verify if the default namespace is modified:
kubectl config view --minify | grep namespace:
You should see the namespace has been set:
namespace: api7
Add a New Gateway Group
Navigate to the Dashboard:
- Select Gateway Groups from the side navigation bar and then click Add Gateway Group.
- Select Ingress Controller as Type.
- Enter
api7-ingress
in the Name field. - Click Add.
Install Ingress Controller
Copy the deployment script generated and run it in the terminal. If deployed successfully, you should see a response similar to the following:
NAME: api7-ingress
LAST DEPLOYED: Wed Jun 19 17:20:24 2024
NAMESPACE: api7
STATUS: deployed
REVISION: 1
TEST SUITE: None
Install Gateway Instance
Navigate to the Dashboard:
- Select Gateway Instances from the side navigation bar and then click Add Gateway Instance.
- Switch to the Kubernetes tab.
- Fill out the namespace and other parameters, and click Generate to see the deployment script.
- Run the deployment script in the terminal.
When installing API7 Enterprise, a gateway group default
is initialized with one gateway instance. To avoid port conflicts, you can modify the listening ports of the new gateway instance, or remove the unused instance in the default
gateway group.
Verify
Check the pod status:
kubectl get pods
You should see all pods in the Running
status:
NAME READY STATUS RESTARTS AGE
api7-ee-3-gateway-698f85d98b-jxrwp 1/1 Running 0 6m
api7-ingress-api7-ingress-controller-b4487c7c-p5qzk 1/1 Running 0 10m
Check the services:
kubectl get services
You should see a response similar to the following:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
api7-ee-3-gateway-gateway NodePort 10.96.106.11 <none> 80:32469/TCP 6m
api7-ingress-api7-ingress-controller ClusterIP 10.96.61.45 <none> 80/TCP 10m
api7-ingress-api7-ingress-controller-apisix-gateway NodePort 10.96.85.233 <none> 80:32160/TCP,443:31815/TCP 10m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 10m
Navigate back to the Dashboard and select Gateway Instances, you should see a gateway instance in healthy
status. Note that resources created with API7 Ingress Controller will be read-only in the Dashboard.
Next Steps
- Learn how to create a gateway instance in the gateway group.
- Follow the getting started tutorials to learn more about using API7 Ingress Controller in API7 Enterprise.