test de ingressroute
All checks were successful
Web/ip/pipeline/head This commit looks good
web/ip/pipeline/head This commit looks good

This commit is contained in:
Julien Cabillot 2021-08-06 21:44:19 -04:00
parent d27c5c9684
commit 13193d699e
5 changed files with 91 additions and 28 deletions

View File

@ -1,7 +1,7 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: "ip-deployment" name: "ip"
labels: labels:
app: "front" app: "front"
spec: spec:
@ -16,6 +16,19 @@ spec:
containers: containers:
- name: "front-apache" - name: "front-apache"
image: "jcabillot/ip" image: "jcabillot/ip"
ports:
- name: "http"
containerPort: 8080
protocol: "TCP"
livenessProbe:
httpGet:
path: "/"
port: "http"
readinessProbe:
httpGet:
path: "/"
port: "http"
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:

View File

@ -1,25 +1,25 @@
--- ---
apiVersion: networking.k8s.io/v1 #apiVersion: networking.k8s.io/v1
kind: Ingress #kind: Ingress
metadata: #metadata:
name: "ip-deployment" # name: "ip"
annotations: # annotations:
kubernetes.io/ingress.class: "traefik" # kubernetes.io/ingress.class: "traefik"
traefik.ingress.kubernetes.io/router.entrypoints: "web,websecure" # traefik.ingress.kubernetes.io/router.entrypoints: "web,websecure"
cert-manager.io/cluster-issuer: "letsencrypt-prod" # cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec: #spec:
tls: # tls:
- hosts: # - hosts:
- "ip.opti.cabillot.eu" # - "ip.opti.cabillot.eu"
secretName: "ipcabilloteu-tls" # secretName: "ipcabilloteu-tls"
rules: # rules:
- host: "ip.opti.cabillot.eu" # - host: "ip.opti.cabillot.eu"
http: # http:
paths: # paths:
- path: "/" # - path: "/"
pathType: "Prefix" # pathType: "Prefix"
backend: # backend:
service: # service:
name: "ip-deployment" # name: "ip"
port: # port:
name: "http" # name: "http"

View File

@ -0,0 +1,50 @@
---
# TODO: Named port for service
# but currently unsupported on my k3s cluster https://github.com/traefik/traefik/pull/7668
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: "ip-websecure"
spec:
entryPoints:
- "websecure"
routes:
- kind: Rule
match: Host(`ip.opti.cabillot.eu`)
middlewares: []
priority: 10
services:
- kind: Service
name: "ip"
port: 80
tls:
secretName: "ipcabilloteu-tls"
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: "ip-web"
spec:
entryPoints:
- "web"
routes:
- match: Host(`ip.opti.cabillot.eu`)
kind: Rule
priority: 10
services:
# in this IngressRoute the service will be never called
# because of the redirect middleware BUT DO NOT REMOVE !
- kind: Service
name: "ip"
port: 80
middlewares:
- name: "httpsredirect"
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: "httpsredirect"
spec:
redirectScheme:
scheme: https
permanent: true

View File

@ -1,7 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- depl.yml - depl.yml
- ingress.yml - ingress.yml
- ingressroute.yml
- svc.yml - svc.yml

View File

@ -1,13 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: 'ip-deployment' name: 'ip'
spec: spec:
type: "ClusterIP" type: "ClusterIP"
ports: ports:
- name: "http" - name: "http"
port: 80 port: 80
protocol: "TCP" protocol: "TCP"
targetPort: 8080 targetPort: "http"
selector: selector:
app: "front" app: "front"