setup ingress for hello-world to use https only

This commit is contained in:
2022-08-05 08:04:37 -04:00
parent b1470afd80
commit bbc6b7818d
10 changed files with 107 additions and 9 deletions

View File

@@ -0,0 +1,15 @@
---
#configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: hello-world
namespace: default
data:
index.html: |
<html>
<head>
<title>Hello World!</title>
</head>
<body>Hello World!</body>
</html>

View File

@@ -0,0 +1,28 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world-nginx
namespace: default
spec:
selector:
matchLabels:
app: hello-world
replicas: 3
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: hello-world-volume
mountPath: /usr/share/nginx/html
volumes:
- name: hello-world-volume
configMap:
name: hello-world

View File

@@ -0,0 +1,6 @@
<html>
<head>
<title>Hello World!</title>
</head>
<body>Hello World!</body>
</html>

View File

@@ -0,0 +1,25 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world
namespace: default
annotations:
kubernetes.io/ingress.class: "traefik"
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: www.xai-corp.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-world
port:
number: 80
tls: # < placing a host in the TLS config will determine what ends up in the cert's subjectAltNames
- secretName: xai-corp-production-tls

View File

@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
namespace: default
spec:
ports:
- port: 80
protocol: TCP
selector:
app: hello-world