运维开发实践 - 服务网关 - apisix部署

1. Apache Apisix

Apache Apisix 是一个动态,实时,高性能的云原生API网关,提供负载均衡,动态上游,灰度发布,服务熔断,身份认证,可观测性等丰富的流量管理功能;
在这里插入图片描述

2. 如何部署

下文将 apisix, apisix-dashboar, apisix-ingresscontroller 独立部署,用户可以按需部署;

helm repo add apisix https://charts.apiseven.com && helm repo update 

# 部署apisix-gateway
helm upgrade --install apisix apisix/apisix --create-namespace  --namespace apisix --set dashboard.enabled=false --set ingress-controller.enabled=false

# http://apisix-dashboard.liyuan.com:31080/
# 默认账号密码均为 admin
helm install apisix-dashboard apisix/apisix-dashboard --create-namespace --namespace apisix
k apply -f ./apisix-dashboard-ingress.yaml


 # 部署apisix ingress-controller, 使用v3的adminAPI
 # 可做CRD以及Ingress Controller功能,可自行选择
helm upgrade --install apisix-ingress-controller  apisix/apisix-ingress-controller --set image.tag=1.7.0 --set config.apisix.adminAPIVersion=v3 --set config.apisix.serviceNamespace=apisix --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

在这里插入图片描述

2.1. 注意事项

(1) 需要检查apisix-dashboard configmap中allow_domain一项,并确保该值包括 0.0.0.0/0, 表示任意ip均能访问该dashboard

(2) 若apisix-ingresscontroller无法连接上apisix-gateway,但是apisix-gateway服务都是正常状态, 检查 apisix-ingresscontroller config 中 adminAPIVersion, 可以尝试切换 v2v3 版本;

(3) etcd 维护起来有些难度,需要自行斟酌,可以参考 APISIX Ingress Controller:一种无需 etcd 的轻量级部署方式

3. 参考

apisix-helm-chart github
Apache APISIX Helm Chart
APISIX Ingress Controller:一种无需 etcd 的轻量级部署方式
Apache Apisix Helm Chart Q&A

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值