Standalone Version
First, create a virtual network for communication between applications:
docker network create apisix-network --driver bridge
Create etcd persistent storage volume:
docker volume create --name etcd-data
Start the standalone version of etcd:
docker run -d --name etcd \
--network apisix-network \
--volume=etcd-data:/etcd-data \
-p 2379:2379 \
-p 2380:2380 \
-e ALLOW_NONE_AUTHENTICATION=yes \
-e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 \
bitnami/etcd:latest
Create apisix configuration file:
cat << EOF > /data/apisix/apisix_conf/config.yaml
deployment:
role: traditional
role_traditional:
config_provider: etcd
admin:
allow_admin:
- 0.0.0.0/0 # Please set it to the subnet address you obtained.
# If not set, by default all IP access is allowed.
etcd:
host:
- "http://etcd:2379"
prefix: "/apisix"
timeout: 30
EOF
Deploy apisix:
docker run -d --name apache-apisix \
--network apisix-network \
-p 9080:9080 \
-p 9180:9180 \
-v /data/apisix/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml \
apache/apisix
Test for response:
curl "http://127.0.0.1:9180/apisix/admin/services/" \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'
Edit apisix-dashboard configuration file:
/data/apisix/apisix-dashboard/conf.yaml
Configuration reference: https://github.com/apache/apisix-dashboard/blob/master/api/conf/conf.yaml
conf:
listen:
host: 0.0.0.0
port: 9000
etcd:
endpoints:
- "http://etcd:2379" # etcd port address
log:
error_log:
level: warn
file_path:
logs/error.log
access_log:
file_path:
logs/access.log
authentication:
secret:
secret # secret for jwt token generation.
expire_time: 3600 # jwt token expire time, in seconds
users: # yamllint enable rule:comments-indentation
- username: admin # username and password for login `manager api`
password: admin
- username: user
password: user
plugins:
- api-breaker
- authz-casbin
- authz-casdoor
- authz-keycloak
- aws-lambda
- azure-functions
- basic-auth
# - batch-requests
- clickhouse-logger
- client-control
- consumer-restriction
- cors
- csrf
- datadog
# - dubbo-proxy
- echo
- error-log-logger
# - example-plugin
- ext-plugin-post-req
- ext-plugin-post-resp
- ext-plugin-pre-req
- fault-injection
- file-logger
- forward-auth
- google-cloud-logging
- grpc-transcode
- grpc-web
- gzip
- hmac-auth
- http-logger
- ip-restriction
- jwt-auth
- kafka-logger
- kafka-proxy
- key-auth
- ldap-auth
- limit-conn
- limit-count
- limit-req
- loggly
# - log-rotate
- mocking
# - node-status
- opa
- openid-connect
- opentelemetry
- openwhisk
- prometheus
- proxy-cache
- proxy-control
- proxy-mirror
- proxy-rewrite
- public-api
- real-ip
- redirect
- referer-restriction
- request-id
- request-validation
- response-rewrite
- rocketmq-logger
- server-info
- serverless-post-function
- serverless-pre-function
- skywalking
- skywalking-logger
- sls-logger
- splunk-hec-logging
- syslog
- tcp-logger
- traffic-split
- ua-restriction
- udp-logger
- uri-blocker
- wolf-rbac
- zipkin
- elasticsearch-logger
- openfunction
- tencent-cloud-cls
- ai
- cas-auth
Deploy the management panel:
docker run -d --name apisix-dashboard \
--network apisix-network \
-p 9000:9000 \
-v /data/apisix/apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml \
apache/apisix-dashboard:2.15.0-centos
docker-compose
Use docker-compose for one-click deployment, reference:
https://github.com/apache/apisix-docker/blob/master/example/docker-compose.yml
helm
First, create three persistent volumes:
apiVersion: v1
kind: PersistentVolume
metadata:
name: apisi-etcd-pv0
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /data/etcd0
type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: apisi-etcd-pv1
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /data/etcd1
type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: apisi-etcd-pv2
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /data/etcd2
type: DirectoryOrCreate
---
kubectl -n apisix apply -f pv.yaml
The namespace needs to be modified according to the actual situation.
Install apisix:
helm install apisix apisix/apisix --create-namespace --namespace apisix
Install dashboard:
helm install apisix-dashboard apisix/apisix-dashboard --create-namespace --namespace apisix
文章评论