Skip to content

Instantly share code, notes, and snippets.

@Rishi16royy
Last active April 28, 2022 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rishi16royy/50d934fec866ae3f669b0910aa7cc221 to your computer and use it in GitHub Desktop.
Save Rishi16royy/50d934fec866ae3f669b0910aa7cc221 to your computer and use it in GitHub Desktop.
Yaml for setting up kong on Kubernetes cluster.
kind: Service
apiVersion: v1
metadata:
name: kong
namespace: kong
labels:
app.kubernetes.io/name: kong
app.kubernetes.io/part-of: kong
spec:
ports:
- name: proxy
port: 80
protocol: TCP
targetPort: 8000
- name: proxy-ssl
port: 443
protocol: TCP
targetPort: 8443
- name: admin-api
port: 8001
protocol: TCP
targetPort: 8001
- name: admin-api-ssl
port: 8444
protocol: TCP
targetPort: 8444
- name: prometheus
port: 8100
protocol: TCP
targetPort: 8100
selector:
app: kong-archext
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kong
namespace: kong
labels:
app.kubernetes.io/name: kong
app.kubernetes.io/part-of: kong
app: kong
spec:
replicas: 1
selector:
matchLabels:
app: kong
template:
metadata:
annotations:
kuma.io/gateway: enabled
prometheus.io/port: "8100"
prometheus.io/scrape: "true"
traffic.sidecar.istio.io/includeInboundPorts: ""
labels:
app: kong
spec:
containers:
- name: kong
image: kong:2.8
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /status
port: 8100
initialDelaySeconds: 100
failureThreshold: 3
periodSeconds: 10
readinessProbe:
httpGet:
path: /status
port: 8100
initialDelaySeconds: 20
failureThreshold: 4
periodSeconds: 10
startupProbe:
httpGet:
path: /status
port: 8100
initialDelaySeconds: 10
failureThreshold: 10
periodSeconds: 10
lifecycle:
preStop:
exec:
command: [
"sh", "-c",
"kong quit",
]
env:
- name: "KONG_DATABASE"
value: "postgres"
- name: "KONG_PG_HOST"
value: "<Please Enter>"
- name: "KONG_PG_DATABASE"
value: "<Please Enter>" # by default - "kong"
- name: "KONG_PG_USER"
value: "<Please Enter>" # by default - "postgres"
- name: "KONG_PG_PASSWORD"
value: "<Please Enter>"
- name: "KONG_PROXY_LISTEN"
value: "0.0.0.0:8000, 0.0.0.0:8443 ssl http2"
- name: "KONG_PORT_MAPS"
value: "80:8000, 443:8443"
- name: "KONG_ADMIN_LISTEN"
value: "0.0.0.0:8001, 0.0.0.0:8444 ssl"
- name: "KONG_STATUS_LISTEN"
value: "0.0.0.0:8100"
- name: "KONG_NGINX_WORKER_PROCESSES"
value: "2"
- name: "KONG_ADMIN_ACCESS_LOG"
value: "/dev/stdout"
- name: "KONG_ADMIN_ERROR_LOG"
value: "/dev/stderr"
- name: "KONG_PROXY_ERROR_LOG"
value: "/dev/stderr"
- name: "KONG_LOG_LEVEL"
value: "notice"
- name: "KONG_NGINX_MAIN_ENV"
value: "KONG_ENV"
ports:
- containerPort: 8000
name: proxy
protocol: TCP
- containerPort: 8443
name: proxy-ssl
protocol: TCP
- containerPort: 8001
name: admin-api
protocol: TCP
- containerPort: 8444
name: admin-api-ssl
protocol: TCP
- containerPort: 8100
name: metrics
protocol: TCP
resources:
requests:
memory: "1024M"
cpu: "0.5"
limits:
memory: "2048M"
cpu: "2"
restartPolicy: Always
imagePullSecrets:
- name: dockercred
terminationGracePeriodSeconds: 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment