Skip to content

Instantly share code, notes, and snippets.

@ll911
Last active July 27, 2018 20:55
Show Gist options
  • Select an option

  • Save ll911/5983f31983df21aff2ac2caf98f9eb9c to your computer and use it in GitHub Desktop.

Select an option

Save ll911/5983f31983df21aff2ac2caf98f9eb9c to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Service
metadata:
name: kong-k8s
spec:
type: LoadBalancer
loadBalancerSourceRanges:
- 0.0.0.0/0
ports:
- name: kong-proxy
port: 8000
targetPort: 8000
protocol: TCP
- name: kong-proxy-ssl
port: 8443
targetPort: 8443
protocol: TCP
- name: kong-admin
port: 8001
targetPort: 8001
protocol: TCP
- name: kong-admin-ssl
port: 8444
targetPort: 8444
protocol: TCP
- name: gw-cache
port: 6379
targetPort: 6379
protocol: TCP
selector:
app: kong
---
apiVersion: v1
data:
redis.conf: |-
appendonly no
protected-mode yes
kind: ConfigMap
metadata:
name: gw-cache
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kong-k8s
spec:
replicas: 1
template:
metadata:
labels:
name: kong-k8s
app: kong
spec:
containers:
- name: kong
image: kong:0.14.0-centos
env:
- name: KONG_ADMIN_LISTEN
value: "0.0.0.0:8001, 0.0.0.0:8444 ssl"
- name: KONG_DATABASE
value: cassandra
- name: KONG_CASSANDRA_CONTACT_POINTS
value: cassandra
- name: KONG_CASSANDRA_KEYSPACE
value: kong
- name: KONG_CASSANDRA_REPL_FACTOR
value: '3'
- name: KONG_TRUSTED_IPS
value: 172.51.0.0/16,142.34.143.128/26
- name: KONG_REAL_IP_RECURSIVE
value: 'on'
- name: KONG_NGINX_LARGE_CLIENT_HEADER_BUFFERS
value: '4 64K'
- 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"
ports:
- name: admin
containerPort: 8001
protocol: TCP
- name: proxy
containerPort: 8000
protocol: TCP
- name: proxy-ssl
containerPort: 8443
protocol: TCP
- name: admin-ssl
containerPort: 8444
protocol: TCP
readinessProbe:
httpGet:
path: /status
port: 8001
scheme: HTTP
initialDelaySeconds: 120
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 5
livenessProbe:
httpGet:
path: /status
port: 8001
scheme: HTTP
initialDelaySeconds: 180
timeoutSeconds: 5
periodSeconds: 30
successThreshold: 1
failureThreshold: 5
volumeMounts:
- name: kong-run
mountPath: /usr/local/kong
- name: redis
image: redis
ports:
- containerPort: 6379
name: client
command: ["redis-server"]
args: ["/conf/redis.conf"]
readinessProbe:
exec:
command:
- sh
- -c
- "redis-cli -h $(hostname) ping"
initialDelaySeconds: 15
timeoutSeconds: 5
livenessProbe:
exec:
command:
- sh
- -c
- "redis-cli -h $(hostname) ping"
initialDelaySeconds: 20
periodSeconds: 3
volumeMounts:
- name: conf
mountPath: /conf
readOnly: false
- name: data
mountPath: /data
readOnly: false
volumes:
- name: conf
configMap:
name: gw-cache
items:
- key: redis.conf
path: redis.conf
- name: data
emptyDir: {}
- name: kong-run
emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment