openresty
# ConfigMap
kind: ConfigMap
apiVersion: v1
metadata:
name: birenchong-devops-openresty-stream-conf
namespace: birenchong-devops
annotations:
kubesphere.io/creator: admin
data:
nginx.conf: >-
#user nobody;
#worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their
processing.
pcre_jit on;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 10240;
}
stream {
upstream birenchong-redis {
server birenchong-redis.axxxxl.ng.0001.euc1.cache.amazonaws.com:6379;
}
server {
listen 6379;
proxy_pass birenchong-redis;
}
upstream birenchong-mysql {
server birenchong-mysql.cxxxxxxxxb.eu-central-1.rds.amazonaws.com:3306;
}
server {
listen 3306;
proxy_pass birenchong-mysql;
}
}
http {
include mime.types;
default_type application/octet-stream;
# Enables or disables the use of underscores in client request header fields.
# When the use of underscores is disabled, request header fields whose names contain underscores are marked as invalid and become subject to the ignore_invalid_headers directive.
# underscores_in_headers off;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
# Log in JSON Format
# log_format nginxlog_json escape=json '{ "timestamp": "$time_iso8601", '
# '"remote_addr": "$remote_addr", '
# '"body_bytes_sent": $body_bytes_sent, '
# '"request_time": $request_time, '
# '"response_status": $status, '
# '"request": "$request", '
# '"request_method": "$request_method", '
# '"host": "$host",'
# '"upstream_addr": "$upstream_addr",'
# '"http_x_forwarded_for": "$http_x_forwarded_for",'
# '"http_referrer": "$http_referer", '
# '"http_user_agent": "$http_user_agent", '
# '"http_version": "$server_protocol", '
# '"nginx_access": true }';
# access_log /dev/stdout nginxlog_json;
# See Move default writable paths to a dedicated directory (#119)
# https://github.com/openresty/docker-openresty/issues/119
client_body_temp_path /var/run/openresty/nginx-client-body;
proxy_temp_path /var/run/openresty/nginx-proxy;
fastcgi_temp_path /var/run/openresty/nginx-fastcgi;
uwsgi_temp_path /var/run/openresty/nginx-uwsgi;
scgi_temp_path /var/run/openresty/nginx-scgi;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
# Don't reveal OpenResty version to clients.
# server_tokens off;
}
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Deployment
kind: Deployment
apiVersion: apps/v1
metadata:
name: birenchong-devops-openresty-stream-v1
namespace: birenchong-devops
labels:
app: birenchong-devops-openresty-stream
version: v1
annotations:
deployment.kubernetes.io/revision: '2'
kubesphere.io/creator: admin
spec:
replicas: 1
selector:
matchLabels:
app: birenchong-devops-openresty-stream
version: v1
template:
metadata:
creationTimestamp: null
labels:
app: birenchong-devops-openresty-stream
version: v1
annotations:
logging.kubesphere.io/logsidecar-config: '{}'
spec:
volumes:
- name: volume-kwng0c
configMap:
name: birenchong-devops-openresty-stream-conf
items:
- key: nginx.conf
path: nginx.conf
defaultMode: 420
containers:
- name: openresty
image: 'harbor.birenchong.cn/devops/openresty:1.0'
ports:
- name: tcp-6379
containerPort: 6379
protocol: TCP
- name: tcp-3306
containerPort: 3306
protocol: TCP
resources: {}
volumeMounts:
- name: volume-kwng0c
readOnly: true
mountPath: /etc/openresty/nginx.conf
subPath: nginx.conf
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
nodeSelector:
env: devops
serviceAccountName: default
serviceAccount: default
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
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
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
# Service
kind: Service
apiVersion: v1
metadata:
name: birenchong-devops-openresty-stream
namespace: birenchong-devops
labels:
app: birenchong-devops-openresty-stream
version: v1
annotations:
kubesphere.io/creator: admin
kubesphere.io/serviceType: statelessservice
spec:
ports:
- name: tcp-6379
protocol: TCP
port: 6379
targetPort: 6379
nodePort: 31709
- name: tcp-3306
protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30770
selector:
app: birenchong-devops-openresty-stream
clusterIP: 10.100.255.245
clusterIPs:
- 10.100.255.245
type: NodePort
sessionAffinity: None
externalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
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
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
Last Updated: 2023/11/08, 14:45:54