使用Docker安装Kong - 玩转Kong网关

开发的生活有了Docker以后,一切都变得爽YY了。能够有更多时间回家陪老人孩子。下面介绍下如何使用Docker和k8s部署Kong。git

Docker部署Kong脚本:github

一、安装Dockerdocker

yum install docker;systemctl enable docker;systemctl start docker 数据库

二、建立kong-net网络centos

docker network create kong-net 网络

三、安装postgres数据库post

docker run -d --name kong-database --network=kong-net \url

-p 5432:5432 \ssl

-e "POSTGRES_USER=kong" \开发

-e "POSTGRES_DB=kong" postgres:9.6 

四、初始化kong数据库

docker run --rm --network=kong-net \

-e "KONG_DATABASE=postgres" \

-e "KONG_PG_HOST=kong-database" \

-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database"  \

kong:0.13.1-centos  kong migrations up 

五、启动kong

docker run -d --name kong --network=kong-net \

-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, 0.0.0.0:8444 ssl" \

-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 \

kong:0.13.1-centos  

六、 启动kong-dashboard/konga

docker run --rm -p 8080:8080 --network=kong-net \

pgbi/kong-dashboard  start --kong-url http://kong:8001 

7.、UI管理,konga也是个不错的选择。

参考:https://github.com/pantsel/konga

使用k8s部署:待续

相关文章
相关标签/搜索