Add content

This commit is contained in:
Glenn Y. Rolland 2023-03-21 17:50:27 +01:00
commit e9a145fc91
10 changed files with 197 additions and 0 deletions

48
README.md Normal file
View file

@ -0,0 +1,48 @@
# Projet demo
## Prerequis
* k3d
* kubectl
* helm
* helm-diff
* helmfile
## Créer le cluster
k3d cluster create -c k3d/k3d-cluster.yaml
## Installer les charts helm (avec helmfile)
helmfile apply
## Intaller les différents services (avec kustomize)
### Option 1 : configuration basée sur Ingress (standard kubernetes)
kubectl delete -f kubernetes/ingress-route/
kubectl apply -f kubernetes/ingress/
### Option 2 : configuration basée sur IngressRoute (traefik)
kubectl delete -f kubernetes/ingress/
kubectl apply -f kubernetes/ingress-route/
## Vérifier les objets
### Option 1 : configuration basée sur Ingress (standard kubernetes)
k9s -n web -c ingress
### Option 2 : configuration basée sur IngressRoute (traefik)
k9s -n web -c ingress-route
## Tester le fonctionnement
w3m http://localhost/dokuwiki
w3m http://localhost/wordpress

2
helm/dokuwiki.yaml Normal file
View file

@ -0,0 +1,2 @@
service:
type: ClusterIP

7
helm/wordpress.yaml Normal file
View file

@ -0,0 +1,7 @@
# --set memcached.enabled=true --set memcached.auth.enabled=false
memcached:
enabled: true
auth:
enabled: false
service:
type: ClusterIP

21
helmfile.yaml Normal file
View file

@ -0,0 +1,21 @@
---
# Les repositories que je veux pour Helm
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: demo-wordpress
namespace: web
chart: bitnami/wordpress
# version: 0.26.0
values:
- ./helm/wordpress.yaml
- name: demo-dokuwiki
namespace: web
chart: bitnami/dokuwiki
# version: 0.26.0
values:
- ./helm/dokuwiki.yaml
#

25
k3d/k3d-cluster.yaml Normal file
View file

@ -0,0 +1,25 @@
---
apiVersion: k3d.io/v1alpha4
kind: Simple
metadata:
name: k3d-cluster
servers: 1
agents: 2
image: docker.io/rancher/k3s:v1.25.7-k3s1
registries:
create:
name: registry.local
host: "0.0.0.0"
hostPort: "5000"
options:
# options passed on to K3s itself
k3s:
extraArgs:
- arg: "--kubelet-arg=eviction-hard=imagefs.available<1%,nodefs.available<1%"
nodeFilters:
- server:*
- agent:*
- arg: "--kubelet-arg=eviction-minimum-reclaim=imagefs.available=1%,nodefs.available=1%"
nodeFilters:
- server:*
- agent:*

View file

@ -0,0 +1,28 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: demo-ingress-route
namespace: web
spec:
entryPoints:
- web
routes:
- kind: Rule
match: PathPrefix(`/dokuwiki`)
services:
- kind: Service
name: demo-dokuwiki # OK
namespace: web
passHostHeader: true
port: 80 # OK
scheme: http
- kind: Rule
match: PathPrefix(`/wordpress`)
services:
- kind: Service
name: demo-wordpress # OK
namespace: web
passHostHeader: true
port: 80 # OK
scheme: http

View file

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: demo-ingress
namespace: web
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /dokuwiki
pathType: Prefix
backend:
service:
name: demo-dokuwiki
port:
number: 80
- path: /wordpress
pathType: Prefix
backend:
service:
name: demo-wordpress
port:
number: 80

View file

@ -0,0 +1,8 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ingress.yaml
- ingress-route.yaml

View file

@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
# bases:
resources:
- ../_base
patchesStrategicMerge:
- |-
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: demo-ingress
namespace: web
$patch: delete

View file

@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../_base
patchesStrategicMerge:
- |-
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: demo-ingress-route
namespace: web
$patch: delete