開(kāi)發(fā)的生活有了Docker之后厌处,一切都變得爽YY了特纤。可以有更多時(shí)間回家陪老人孩子尉共。下面介紹下如何使用Docker和k8s部署Kong褒傅。
Docker部署Kong腳本:
1、安裝Docker
yum install docker袄友;systemctl enable docker殿托;systemctl start docker?
2、創(chuàng)建kong-net網(wǎng)絡(luò)
docker network create kong-net?
3剧蚣、安裝postgres數(shù)據(jù)庫(kù)
docker run -d --name kong-database --network=kong-net \
-p 5432:5432?\
-e "POSTGRES_USER=kong"?\
-e "POSTGRES_DB=kong" postgres:9.6?
4支竹、初始化kong數(shù)據(jù)庫(kù)
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?
5、啟動(dòng)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??
6鸠按、?啟動(dòng)kong-dashboard/konga
docker run --rm -p 8080:8080 --network=kong-net \
pgbi/kong-dashboard? start --kong-url http://kong:8001?
7.礼搁、UI管理,konga也是個(gè)不錯(cuò)的選擇待诅。
參考:https://github.com/pantsel/konga
使用k8s部署:待續(xù)
> 穿梭機(jī):[開(kāi)源API網(wǎng)關(guān)系統(tǒng)(Kong教程)入門(mén)到精通](http://www.reibang.com/p/a68e45bcadb6)