Skip to content

Commit

Permalink
Define kubernetes resources
Browse files Browse the repository at this point in the history
- fix kong version to docker-compose.yml
  • Loading branch information
Ashon committed Mar 29, 2018
1 parent ff89fe6 commit 0e60ad2
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
retries: 3

kong-data-migration:
image: kong:latest
image: kong:0.11
links:
- kong-database
environment:
Expand All @@ -31,7 +31,7 @@ services:
condition: service_healthy

kong:
image: kong:latest
image: kong:0.11
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
Expand Down
50 changes: 50 additions & 0 deletions k8s/deploy_kong-apigw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kong-apigw
spec:
replicas: 2
selector:
matchLabels:
name: kong-apigw
template:
metadata:
labels:
name: kong-apigw
spec:
containers:
- name: kong-apigw
image: kong:0.11
env:
- name: KONG_DATABASE
value: postgres
- name: KONG_PG_HOST
value: kong-database
- name: KONG_PG_USERNAME
value: kong
- name: KONG_PG_PASSWORD
value: kong_password
- name: KONG_CASSANDRA_CONTACT_POINTS
value: kong-database
- name: KONG_PROXY_ACCESS_LOG
value: /dev/stdout
- name: KONG_ADMIN_ACCESS_LOG
value: /dev/stdout
- name: KONG_PROXY_ERROR_LOG
value: /dev/stderr
- name: KONG_ADMIN_ERROR_LOG
value: /dev/stderr
- name: KONG_ADMIN_LISTEN
value: 0.0.0.0:8001
- name: KONG_ADMIN_LISTEN_SSL
value: 0.0.0.0:8444
ports:
- name: http
containerPort: 8000
- name: https
containerPort: 8443
- name: admin-http
containerPort: 8001
- name: admin-https
containerPort: 8444
27 changes: 27 additions & 0 deletions k8s/job_kong-migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: kong-migration
spec:
backoffLimit: 5
template:
metadata:
name: kong-migration
spec:
restartPolicy: Never
containers:
- name: kong-migration
image: kong:0.11
command: ["kong", "migrations", "up", "--vv"]
env:
- name: KONG_DATABASE
value: postgres
- name: KONG_PG_HOST
value: kong-database
- name: KONG_PG_USERNAME
value: kong
- name: KONG_PG_PASSWORD
value: kong_password
- name: KONG_CASSANDRA_CONTACT_POINTS
value: kong-database
25 changes: 25 additions & 0 deletions k8s/svc_kong-apigw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v1
kind: Service
metadata:
name: kong-apigw
spec:
selector:
name: kong-apigw
type: NodePort
ports:
- name: kong-http
port: 10080
targetPort: 8000

- name: kong-https
port: 10443
targetPort: 8443

- name: admin-http
port: 10081
targetPort: 8001

- name: admin-https
port: 10444
targetPort: 8444
36 changes: 36 additions & 0 deletions k8s/svc_kong-database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: v1
kind: Service
metadata:
name: kong-database
spec:
selector:
name: kong-database
ports:
- name: kong-database
port: 5432
targetPort: 5432

---
apiVersion: v1
kind: Pod
metadata:
name: kong-database
labels:
name: kong-database
spec:
hostname: kong-database
containers:
- name: kong-database-pg
image: postgres:9.4
env:
- name: POSTGRES_USER
value: kong
- name: POSTGRES_PASSWORD
value: kong_password
- name: POSTGRES_DB
value: kong
ports:
- name: kong-database
containerPort: 5432
protocol: TCP

0 comments on commit 0e60ad2

Please sign in to comment.