完善k8s文件

This commit is contained in:
2023-08-11 14:50:14 +08:00
parent b234a8c849
commit 9ffd8d3fba
5 changed files with 141 additions and 25 deletions

View File

@@ -2,6 +2,8 @@ resources:
- api.yaml
- redis.yaml
- pg.yaml
- ns.yaml
- nginx.yaml

73
k8s/base/nginx.yaml Normal file
View File

@@ -0,0 +1,73 @@
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 8000
type: NodePort
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
default.conf: |
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
proxypass http://coal-ui:7456/;
}
location /api {
proxypass http://coal-api:7456/;
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /etc/nginx/conf.d/default.conf
name: nginx-conf
subPath: default.conf
restartPolicy: Always
volumes:
- name: nginx-conf
configMap:
items:
- key: default.conf
path: default.conf

4
k8s/base/ns.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: coal