forked from Kong/kong-mesh-dist-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serviceb.yaml
96 lines (95 loc) · 2.53 KB
/
serviceb.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
apiVersion: apps/v1
kind: Deployment
metadata:
name: serviceb
spec:
selector:
matchLabels:
app: serviceb
replicas: 1
template:
metadata:
labels:
app: serviceb
spec:
initContainers:
- name: wait-for-postgres
image: busybox
env:
- name: KONG_PG_HOST
value: postgres
- name: KONG_PG_PORT
value: "5432"
command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ]
- name: setup-network
image: istio/proxy_init:1.0.4
# TODO: This should be `-b *` and not `-b 8080`, the former results
# in DB connection failure in Kong.
args: [ "-p", "7000", "-u", "1337", "-m", "TPROXY", "-i", "*", "-b", "8080"]
securityContext:
capabilities:
add:
- NET_ADMIN
containers:
- name: serviceb
image: itsthenetwork/alpine-ncat
args: ["--listen", "--keep-open", "--verbose", "8080"]
- name: kong
image: kong:mesh
securityContext:
capabilities:
add:
- NET_RAW
env:
- name: KONG_LOG_LEVEL
value: debug
- name: KONG_ORIGINS
value: "tcp://serviceb:8080=tcp://127.0.0.1:8080"
- name: KONG_STREAM_LISTEN
value: "0.0.0.0:7000 transparent"
- name: KONG_PROXY_LISTEN
value: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
- name: KONG_ADMIN_LISTEN
value: "off"
- name: KONG_PG_PASSWORD
value: kong
- name: KONG_PG_HOST
value: postgres
- 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: kongstream
containerPort: 7000
protocol: TCP
- name: kongproxy
containerPort: 8000
protocol: TCP
- name: kongproxyssl
containerPort: 8443
protocol: TCP
- name: kongadmin
containerPort: 8001
protocol: TCP
- name: kongadminssl
containerPort: 8443
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: serviceb
spec:
type: NodePort
ports:
- name: serviceb
port: 8080
targetPort: 8080
protocol: TCP
selector:
app: serviceb