104 lines
1.9 KiB
YAML
104 lines
1.9 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: nginx-https
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: nginx-https
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: nginx-https
|
|
spec:
|
|
containers:
|
|
- name: nginx-https
|
|
image: nginx
|
|
ports:
|
|
- name: web
|
|
containerPort: 80
|
|
ports:
|
|
- name: sslweb
|
|
containerPort: 443
|
|
volumeMounts:
|
|
- name: nginx-cm
|
|
mountPath: /etc/nginx
|
|
- name: nginx-secret
|
|
mountPath: /etc/nginx/ssl
|
|
readOnly: true
|
|
- name: wolumin1
|
|
mountPath: /usr/share/nginx/html
|
|
volumes:
|
|
- name: nginx-cm
|
|
configMap:
|
|
name: nginx-cm
|
|
- name: nginx-secret
|
|
configMap:
|
|
name: nginx-secret
|
|
- name: wolumin1
|
|
hostPath:
|
|
path: /var/nginx
|
|
type: DirectoryOrCreate
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: nginx-cm
|
|
data:
|
|
nginx.conf: |
|
|
user nginx;
|
|
worker_processes 1;
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
http {
|
|
server {
|
|
listen 80;
|
|
listen 443 ssl;
|
|
server_name example.com;
|
|
ssl_certificate /etc/nginx/ssl/server-cert.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/server-key.pem;
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm index.php;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: nginx-https
|
|
labels:
|
|
app: nginx-https
|
|
spec:
|
|
type: LoadBalancer
|
|
ports:
|
|
- port: 8880
|
|
targetPort: 80
|
|
protocol: TCP
|
|
name: http
|
|
- port: 8443
|
|
targetPort: 443
|
|
protocol: TCP
|
|
name: https
|
|
selector:
|
|
app: nginx-https
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
namespace: metallb-system
|
|
name: config
|
|
data:
|
|
config: |
|
|
address-pools:
|
|
- name: default
|
|
protocol: layer2
|
|
addresses:
|
|
- 192.168.100.230-192.168.100.235 |