Apache Apisix 是一个动态,实时,高性能的云原生API网关,提供负载均衡,动态上游,灰度发布,服务熔断,身份认证,可观测性等丰富的流量管理功能;
helm repo add apisix https://charts.apiseven.com && helm repo update
# 部署apisix-gateway 以及apisix-dashboard
helm upgrade --install apisix apisix/apisix --create-namespace --namespace apisix --set dashboard.enabled=true --set ingress-controller.enabled=true --set ingress-controller.config.apisix.serviceNamespace=apisix
# http://apisix-dashboard.liyuan.com:31080/
# 默认账号密码均为 admin
k apply -f ./apisix-dashboard-ingress.yaml
# 部署apisix ingress-controller
# 可做CRD以及Ingress Controller功能,可自行选择
helm install apisix-ingress-controller apisix/apisix-ingress-controller --namespace ingress-apisix --create-namespace
# 测试apisix-ingresscontroller CRD 功能
# 如果登录UI能看到该apply的规则,说明CRD正常工作
k apply -f apisix-test-crd.yaml
# apisix-dashboard-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apisix-dashboard-ingress
namespace: apisix
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: apisix-dashboard.liyuan.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: apisix-dashboard
port:
number: 80
# apisix-test-crd.yaml
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: httpbin-route
spec:
http:
- name: route-1
match:
hosts:
- httpbin.org
paths:
- /*
backends:
# 此处是任意一个同namespace下的服务
- serviceName: nginx-deployment-svc
servicePort: 80
(1) 需要检查apisix-dashboard configmap中allow_domain
一项,并确保该值包括 0.0.0.0/16
, 表示任意ip均能访问该dashboard
(2) 若apisix-ingresscontroller无法连接上apisix-gateway,但是apisix-gateway服务都是正常状态, 检查 apisix-ingresscontroller config 中 adminAPIVersion
, 可以尝试切换 v2
或v3
版本;
(3) etcd 维护起来有些难度,需要自行斟酌,可以参考 APISIX Ingress Controller:一种无需 etcd 的轻量级部署方式
apisix-helm-chart
APISIX Ingress Controller:一种无需 etcd 的轻量级部署方式