初始提交

This commit is contained in:
2026-03-23 10:33:13 +08:00
commit addf335bc6
15 changed files with 1252 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
apiVersion: v1
data:
{{ name }}.conf: >-
server {
listen 80;
server_name {{ superDomain }};
access_log /storage/nginx_logs/{{ name }}_access.log main;
error_log /storage/nginx_logs/{{ name }}_error.log;
location /nginx01 {
if ($request_filename ~* .*\.(?:htm|html)$) {
add_header Cache-Control "no-cache";
}
alias /storage/{{ name }};
index index.html index.htm;
try_files $uri $uri/ /nginx01/index.html;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
kind: ConfigMap
metadata:
name: configmap-{{ name }}
namespace: {{ namespace }}

View File

@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ deployment_name }}
namespace: {{ namespace }}
spec:
replicas: {{ replicas }}
selector:
matchLabels:
app: {{ deployment_name }}
template:
metadata:
labels:
app: {{ deployment_name }}
spec:
containers:
- name: {{ deployment_name }}
image: {{ image }}
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: {{ limits_cpu }}
memory: {{ limits_memory }}
requests:
cpu: {{ requests_cpu }}
memory: {{ requests_memory }}
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 1
volumeMounts:
- mountPath: /etc/localtime
name: localtime
- mountPath: /usr/local/nginx/conf/nginx.conf
name: nginx
subPath: nginx.conf
- mountPath: /usr/local/nginx/conf/conf.d/{{ deployment_name }}.conf
name: {{ deployment_name }}
subPath: {{ deployment_name }}.conf
imagePullSecrets:
- name: {{ imageSecret }}
volumes:
- hostPath:
path: /etc/localtime
type: ''
name: localtime
- configMap:
defaultMode: 420
name: nginx
name: nginx
- configMap:
defaultMode: 420
name: configmap-{{ deployment_name }}
name: {{ deployment_name }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ deployment_name }}
namespace: {{ namespace }}
spec:
ports:
- name: server-port
port: 80
targetPort: 80
selector:
app: {{ deployment_name }}
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ deployment_name }}
namespace: {{ namespace }}
spec:
ingressClassName: {{ ingressClassName }}
rules:
- host: {{ superDomain }}
http:
paths:
- backend:
service:
name: {{ deployment_name }}
port:
number: 80
path: /nginx01
pathType: ImplementationSpecific