title: K3s and RKE (Rancher) keywords:

  • APISIX ingress
  • Apache APISIX
  • Kubernetes ingress
  • K3s
  • Rancher RKE description: Guide to install APISIX ingress controller on K3s and Rancher Kubernetes Engine(RKE).

This document explains how you can install APISIX ingress on k3S and Rancher RKE.

:::tip

K3s is built for IoT and edge computing applications. Apache APISIX also supports an MQTT Plugin and runs well on ARM processors. APISIX ingress is therefore a good choice to handle North-South traffic in K3s.

:::

Prerequisites

Install APISIX and ingress controller

The script below installs APISIX and the ingress controller:

helm repo add apisix https://charts.apiseven.com
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
kubectl create ns ingress-apisix
helm install apisix apisix/apisix \
  --set gateway.type=NodePort \
  --set ingress-controller.enabled=true \
  --namespace ingress-apisix \
  --set ingress-controller.config.apisix.serviceNamespace=ingress-apisix \
  --kubeconfig /etc/rancher/k3s/k3s.yaml
kubectl get service --namespace ingress-apisix

:::info IMPORTANT

If you are using K3s, the default kube config file is located in /etc/rancher/k3s/ and you make require root permission.

:::

This will create the five resources mentioned below:

  • apisix-gateway: dataplane the process the traffic.
  • apisix-admin: control plane that processes all configuration changes.
  • apisix-ingress-controller: ingress controller which exposes APISIX.
  • apisix-etcd and apisix-etcd-headless: stores configuration and handles internal communication.

The gateway service type is set to NodePort. Clients can access APISIX through the Node IPs and the assigned port. To use a service of type LoadBalancer with K3s, use a bare-metal load balancer implementation like Klipper.

You should now be able to use APISIX ingress controller. You can try running this minimal example to see if everything is working perfectly.