-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s_internetloginwithpythonwebservice.yaml
162 lines (147 loc) · 4.44 KB
/
k8s_internetloginwithpythonwebservice.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
## ___ _ _ _ _ __ ___ _ _ ____ _ _ __ __ _ ____ _
## |_ _|_ __ | |_ ___ _ __ _ __ ___| |_| | ___ __ _(_)_ _\ \ / (_) |_ | |__ | _ \ _ _| |_| |__ ___ _ _\ \ / /__| |__/ ___| ___ _ __ __ _(_) ___ ___
## | || '_ \| __/ _ \ '__| '_ \ / _ \ __| | / _ \ / _` | | '_ \ \ /\ / /| | __|| '_ \| |_) | | | | __| '_ \ / _ \| '_ \ \ /\ / / _ \ '_ \___ \ / _ \ '__|\ \ / / |/ __/ _ \
## | || | | | || __/ | | | | | __/ |_| |__| (_) | (_| | | | | \ V V / | | |_ | | | | __/| |_| | |_| | | | (_) | | | \ V V / __/ |_) |__) | __/ | \ V /| | (_| __/
## |___|_| |_|\__\___|_| |_| |_|\___|\__|_____\___/ \__, |_|_| |_|\_/\_/ |_|\__||_| |_|_| \__, |\__|_| |_|\___/|_| |_|\_/\_/ \___|_.__/____/ \___|_| \_/ |_|\___\___|
## |___/ |___/
## InternetLoginWithPythonWebService, short: InternetLoginPyWS
## https://github.com/Tob1as/internetloginwithpythonwebservice
---
apiVersion: v1
kind: Namespace
metadata:
name: adminservices
annotations:
field.cattle.io/description: Services for Admins
---
apiVersion: v1
kind: ConfigMap
metadata:
name: internetloginpyws-env-config
namespace: adminservices
labels:
app: internetloginpyws
data:
TZ: "Europe/Berlin"
HTTPD_BASEPATH: "/internet"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: internetloginpyws
namespace: adminservices
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app: internetloginpyws
template:
metadata:
labels:
app: internetloginpyws
spec:
#imagePullSecrets:
#- name: regcred
containers:
- name: internetloginpyws
image: ghcr.io/tob1as/internetloginwithpythonwebservice:latest
imagePullPolicy: Always #IfNotPresent
envFrom:
- configMapRef:
name: internetloginpyws-env-config
ports:
- containerPort: 8000
name: webservice
protocol: TCP
livenessProbe:
httpGet:
path: /healthcheck
port: 8000
failureThreshold: 4
initialDelaySeconds: 15
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /healthcheck
port: 8000
failureThreshold: 4
initialDelaySeconds: 5
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 10
resources:
requests:
memory: "128Mi"
cpu: "0.1"
limits:
memory: "512Mi"
cpu: "0.5"
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: internetloginpyws
namespace: adminservices
labels:
app: internetloginpyws
spec:
type: ClusterIP
ports:
- name: "webservice"
protocol: TCP
port: 8000
targetPort: 8000
selector:
app: internetloginpyws
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: internetloginpyws
namespace: adminservices
labels:
app: internetloginpyws
annotations:
## https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/
kubernetes.io/ingress.class: nginx
#nginx.ingress.kubernetes.io/ssl-redirect: "false"
#nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
#nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
#nginx.ingress.kubernetes.io/whitelist-source-range: ""
#cert-manager.io/cluster-issuer: ingress-tls-secret
#cert-manager.io/acme-challenge-type: http01
spec:
tls:
- hosts:
- example.com
secretName: ingress-tls-secret
rules:
- host: example.com
http:
paths:
- path: /internet
pathType: ImplementationSpecific
backend:
service:
name: internetloginpyws
port:
#name: webservice
number: 8000
---
## SSL for ingress
## convert ssl files to base64, example:
## for i in $(find . -type f -regex ".*/.*\.\(crt\|key\|pem\)"); do echo -e "\nEncode-File $i:" ; cat $i | base64 -w0 ; done > ssl_convertinbase64.txt
apiVersion: v1
kind: Secret
metadata:
name: ingress-tls-secret
namespace: adminservices
type: kubernetes.io/tls
data:
tls.crt: <ssl.crt>
tls.key: <ssl.key>