Files
coal/k8s/base/nginx.yaml
2023-08-11 14:50:14 +08:00

73 lines
1.2 KiB
YAML

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