一、前提条件

  • Kubernetes 版本至少 1.12+(建议 1.19+ 或更高)

  • Helm 版本 3.x(建议 3.8+)

  • 已配置 kubectl 并可访问 Kubernetes 集群。

  • 根据需要准备好:存储卷(如果你希望启用持久化)、网络负载均衡 / Ingress 权限、镜像拉取凭证(如私有仓库)等。

二、添加 Helm 仓库 & 更新

helm repo add apisix https://apache.github.io/apisix-helm-chart helm repo update

三、开始安装

1. 版本信息

安装包

Chart版本

APP VERSION

apisix

2.12.1

3.14.1

apisix-ingress-controller

1.0.5

2.0.0-rc4

apisix-dashboard

0.8.3

3.0.0

etcd

12.0.18

3.6.4

2. 安装包

https://download.csdn.net/download/weixin_43798031/92196775

3. 安装命令

生产环境 etcd要单独分开部署,参考 etcd 部署安装

# apisix 安装 
helm upgrade -i -f values.yaml apisix . -n apisix 
# apisix dashboard 安装 
helm upgrade -i -f values.yaml apisix-dashboard . -n apisix

4. 查看安装结果

root@10-55-2-40:/home/sunwenbo/helm-install/apisix# kubectl  get pod -n apisix  
NAME                                READY   STATUS      RESTARTS   AGE
apisix-589fdb784f-4wdvw             1/1     Running     0          16h
apisix-dashboard-7b8bc7f7b4-nh54r   1/1     Running     0          44h
apisix-etcd-0                       1/1     Running     0          23h
apisix-etcd-1                       1/1     Running     0          23h
apisix-etcd-2                       1/1     Running     0          23h
apisix-etcd-pre-upgrade-9xcvd       0/1     Completed   0          16h

四、配置说明

1. Apisix 配置

只粘贴需要修改的部门

global:
  imagePullSecrets:
    - "uhub-registry"  
image:
  # -- Apache APISIX image repository
  repository: uhub.service.ucloud.cn/base-image/apisix
replicaCount: 3
priorityClassName: "high-priority"

hostNetwork: true

nodeSelector:
  node-role.kubernetes.io/master: ""
  apisix: "true"
  
tolerations:
  - key: "node-role.kubernetes.io/master"
    operator: "Exists"
    effect: "NoSchedule"
    
timezone: "Asia/Shanghai"

serviceAccount:
  create: true
  annotations: {}
  name: "apisix-discovery"

rbac:
  create: true
service:
  type: ClusterIP
  externalTrafficPolicy: ""
  
  stream:
    enabled: true
    tcp:
      - 9100
    udp:
      - 9200
      
control:
  enabled: true
  ip: "0.0.0.0"
metrics:
  serviceMonitor:
    enabled: true
    namespace: "apisix"
    name: "apisix-servicemonitor"
    interval: 15s
    labels: {}
    annotations: {}
    
  deployment:
    mode: traditional
    role: "traditional"
    role_traditional:
      config_provider: "etcd"
      
  admin:
    enabled: true
    credentials:
      admin: edd1c9f034335f136f87ad84b625c8f1
      viewer: 4054f7cf07e344346cd3f287985e76a2
      
    allow:
      ipList:
        - 0.0.0.0/0

  nginx:
    workerRlimitNofile: "20480"
    workerConnections: "10620"
    logs:
      accessLogFormat: "{\"server_name\":\"$server_name\",\"server_addr\":\"$server_addr\",\"eagleeye_traceid\":\"$http_eagleeye_traceid\",\"request_id\":\"$request_id\",\"http_x_request_sunwenbo_id\":\"$http_x_request_sunwenbo_id\",\"log_id\":\"$upstream_http_x_log_id\",\"request_time\":\"$request_time\",\"request_length\":\"$request_length\",\"remote_addr\":\"$remote_addr\",\"http_x_forwarded_for\":\"$http_x_forwarded_for\",\"request_uri\":\"$request_uri\",\"status\":\"$status\",\"bytes_sent\":\"$bytes_sent\",\"body_bytes_sent\":\"$body_bytes_sent\",\"upstream_status\":\"$upstream_status\",\"upstream_addr\":\"$upstream_addr\",\"upstream_connect_time\":\"$upstream_connect_time\",\"upstream_header_time\":\"$upstream_header_time\",\"upstream_response_time\":\"$upstream_response_time\",\"upstream_response_length\":\"$upstream_response_length\",\"http_user_agent\":\"$http_user_agent\",\"http_referer\":\"$http_referer\"}"
      
  discovery:
    enabled: true
    kubernetes: {}
    
  prometheus:
    enabled: true
    
externalEtcd:
  host:
    - http://etcd.host:2379
  user: root
  password: ""
  existingSecret: ""
  secretPasswordKey: "etcd-root-password"
  
etcd:
  enabled: true
  image:
    registry: uhub.service.ucloud.cn
    repository: base-image/etcd
    tag: 3.6.4-debian-12-r3
  auth:
    rbac:
      create: true
      rootPassword: "admin"
    tls:
      enabled: false
      existingSecret: ""
      certFilename: ""
      certKeyFilename: ""
      verify: true
      sni: ""
  containerSecurityContext:
    enabled: false

  service:
    port: 2379

  replicaCount: 3
  autoCompactionRetention: "1h"
  autoCompactionMode: "periodic"

ingress-controller:
  enabled: true

2. Apisix 配置文件

vim templates/configmap.yaml

        real_ip_recursive: "on"
        real_ip_from:
          - 0.0.0.0/0
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐