docker安装kong和kong-dashboard

1:docker安装遵循官方手册

2:安装kong

  参考文档:https://getkong.org/install/docker/ 

   安装过程基本和文档一致,文档十分简单清晰。

   但应注意,为了最新版kong-dashboard,使用的kong镜像为 0.12版本。

   否则kong-dashboard不支持。

  注意:本文档使用postgres数据库

2.1 安装postgres

      docker run -d --name kong-database  -p 5432:5432  -e "POSTGRES_USER=kong"  -e "POSTGRES_DB=kong"  postgres

2.2 

    docker run --rm  --link kong-database:kong-database  -e "KONG_DATABASE=postgres"  -e "KONG_PG_HOST=kong-database"  -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" kong:0.12 kong migrations up

   如果使用的cassandra,KONG_DATABASE属性对应修改为cassandra就可以了。

 

2.3

docker run -d --name kong \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001" \
-e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong:0.12

 

3: 添加kong-dashboard

参考文档:https://github.com/PGBI/kong-dashboard

注意:kong-dashboard应该使用最新版,旧版本(如v2)有bug,访问kong server一直报错。

# Start Kong Dashboard
docker run --rm -p 8080:8080 pgbi/kong-dashboard start --kong-url http://kong:8001

# Start Kong Dashboard on a custom port
docker run --rm -p [port]:8080 pgbi/kong-dashboard start --kong-url http://kong:8001

# Start Kong Dashboard with basic auth
docker run --rm -p 8080:8080 pgbi/kong-dashboard start \
  --kong-url http://kong:8001
  --basic-auth user1=password1 user2=password2

# See full list of start options
docker run --rm -p 8080:8080 pgbi/kong-dashboard start --help

 

以上。

 

 

 

 

     

posted on 2018-04-27 16:52  红色十月  阅读(4978)  评论(1编辑  收藏  举报