kong+konga+pgs部署
deployment部署
apiVersion: v1
kind: Service
metadata:
name: kong-pgs
namespace: kong
spec:
ports:
- name: port-5432
port: 5432
protocol: TCP
targetPort: 5432
nodePort: 35432
selector:
application: kong-pgs
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kong-pgs
namespace: kong
spec:
replicas: 1
selector:
matchLabels:
application: kong-pgs
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
application: kong-pgs
spec:
containers:
- name: kong-pgs
env:
- name: POSTGRES_USER
value: kong
- name: POSTGRES_DB
value: kong
- name: POSTGRES_PASSWORD
value: kong
image: postgres:9.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
protocol: TCP
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pgs-storage
nodeName: k8s-master-1
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumes:
- name: pgs-storage
hostPath:
path: /kong/pgs
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kong
namespace: kong
spec:
replicas: 1
selector:
matchLabels:
application: kong
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
application: kong
spec:
# 初始化pgs数据库
initContainers:
- name: init-pgs
image: kong:2.8.1
imagePullPolicy: IfNotPresent
command: ["/bin/sh","-c","kong migrations bootstrap"]
env:
- name: KONG_PG_HOST
value: kong-pgs.kong.svc.cluster.local
- name: KONG_PG_PORT
value: "5432"
- name: KONG_PG_PASSWORD
value: kong
- name: KONG_DATABASE
value: postgres
containers:
- name: kong
env:
- name: KONG_PG_HOST
value: kong-pgs.kong.svc.cluster.local
- name: KONG_PG_PORT
value: "5432"
- name: KONG_PG_PASSWORD
value: kong
- name: KONG_DATABASE
value: postgres
- name: KONG_PROXY_ERROR_LOG
value: /dev/stderr
- name: KONG_PROXY_ACCESS_LOG
value: /dev/stdout
- name: KONG_ADMIN_ACCESS_LOG
value: /dev/stdout
- name: KONG_ADMIN_ERROR_LOG
value: /dev/stderr
- name: KONG_ADMIN_LISTEN
value: 0.0.0.0:8001, 0.0.0.0:8444
- name: KONG_LOG_LEVEL
value: error
- name: KONG_NGINX_WORKER_PROCESSES
value: "1"
image: kong:2.8.1
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /status
port: 8001
scheme: HTTP
initialDelaySeconds: 120
periodSeconds: 20
successThreshold: 1
successThreshold: 1
timeoutSeconds: 6
ports:
- name: kong-proxy
containerPort: 8000
protocol: TCP
- name: kong-admin
containerPort: 8001
protocol: TCP
- name: kong-proxy-ssl
containerPort: 8443
protocol: TCP
- name: kong-admin-ssl
containerPort: 8444
protocol: TCP
readinessProbe:
failureThreshold: 1
httpGet:
path: /status
port: 8001
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 6
nodeName: k8s-master-1
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: konga
namespace: kong
spec:
replicas: 1
selector:
matchLabels:
application: konga
template:
metadata:
labels:
application: konga
spec:
containers:
- name: konga
env:
- name: KONGA_LOG_LEVEL
value: info
- name: NODE_ENV
value: development
- name: DB_ADAPTER # 指定数据库类型
value: postgres
- name: DB_HOST
value: kong-pgs.kong.svc.cluster.local
- name: DB_PORT
value: "5432"
- name: DB_USER
value: kong
- name: DB_PASSWORD
value: kong
- name: DB_DATABASE
value: postgres
image: pantsel/konga:0.14.9
imagePullPolicy: IfNotPresent
ports:
- containerPort: 1337
protocol: TCP
nodeName: k8s-master-1
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: konga
namespace: kong
spec:
ports:
- name: port-1337
port: 1337
protocol: TCP
targetPort: 1337
nodePort: 31337
selector:
application: konga
type: NodePort
# 查看pod信息
[root@k8s-master-1 kong]# kubectl get pods -n kong
NAME READY STATUS RESTARTS AGE
kong-7dff9d88bb-ptp7h 1/1 Running 0 21m
kong-pgs-5454ff7f54-q9xlf 1/1 Running 0 21m
konga-8d8bc59fb-wjlhz 1/1 Running 0 2m38s
konga登陆
版权声明:本文为qq_41586875原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。