apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: nginx-config
|
|
data:
|
|
default.conf: |
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
location / {
|
|
add_header Content-Type text/plain; # Prevents download
|
|
return 200 "Hello world! Kubernetes + Let's encrypt demo.";
|
|
}
|
|
---
|
|
apiVersion: v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app: nginx
|
|
name: nginx
|
|
spec:
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: nginx
|
|
spec:
|
|
containers:
|
|
- name: nginx
|
|
image: nginx
|
|
ports:
|
|
- containerPort: 80
|
|
volumeMounts:
|
|
- name: nginx-configs
|
|
mountPath: /etc/nginx/conf.d
|
|
# Load the configuration files for nginx
|
|
volumes:
|
|
- name: nginx-configs
|
|
configMap:
|
|
name: nginx-config
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: nginx
|
|
spec:
|
|
selector:
|
|
app: nginx
|
|
ports:
|
|
- protocol: "TCP"
|
|
port: 80
|