This commit is contained in:
nutzer26
2022-12-16 12:21:57 +01:00
parent 199a7e11b5
commit 8ee05cb88d
60 changed files with 3516 additions and 2 deletions

152
traefik/doku Normal file
View File

@@ -0,0 +1,152 @@
mkdir ~/traefik && cd ~/traefik
helm repo add traefik https://helm.traefik.io/traefik
helm repo update
helm pull traefik/traefik --untar
cd traefik
tree .
.
├── Changelog.md
├── Chart.yaml
├── crds
│ ├── ingressroutetcp.yaml
│ ├── ingressrouteudp.yaml
│ ├── ingressroute.yaml
│ ├── middlewarestcp.yaml
│ ├── middlewares.yaml
│ ├── serverstransports.yaml
│ ├── tlsoptions.yaml
│ ├── tlsstores.yaml
│ └── traefikservices.yaml
├── Guidelines.md
├── LICENSE
├── README.md
├── templates
│ ├── daemonset.yaml
│ ├── dashboard-hook-ingressroute.yaml
│ ├── deployment.yaml
│ ├── extra-objects.yaml
│ ├── gatewayclass.yaml
│ ├── gateway.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingressclass.yaml
│ ├── poddisruptionbudget.yaml
│ ├── _podtemplate.tpl
│ ├── pvc.yaml
│ ├── rbac
│ │ ├── clusterrolebinding.yaml
│ │ ├── clusterrole.yaml
│ │ ├── podsecuritypolicy.yaml
│ │ ├── rolebinding.yaml
│ │ ├── role.yaml
│ │ └── serviceaccount.yaml
│ ├── _service.tpl
│ ├── service.yaml
│ ├── tlsoption.yaml
│ └── tlsstore.yaml
└── values.yaml
3 directories, 37 files
# install
kubectl create ns traefik-v2
helm install --namespace=traefik-v2 \
traefik traefik/traefik
kubectl -n traefik-v2 get all
cd ../web/
cat >ingress-values.yaml <<EOF
ingress:
enabled: true
className: ""
annotations:
kubernetes.io/ingress.class: traefik
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: web.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
EOF
helm template --values ingress-values.yaml --set image.tag=1.21.3 . |more
helm upgrade web --values ingress-values.yaml --set image.tag=1.21.3 .
curl -H "Host: web.local" http://127.0.0.1:8580
Beispiel Ingress Manifest
# Source: web/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: release-name-web
labels:
helm.sh/chart: web-0.1.0
app.kubernetes.io/name: web
app.kubernetes.io/instance: release-name
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: "web.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: release-name-web
port:
number: 80
cat >~/carpool/app/ingress.yaml <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: carpool
labels:
app.kubernetes.io/name: carpool
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: "carpool.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: carpool
port:
number: 5000
EOF
kubectl apply -n carpool -f ~/carpool/app/ingress.yaml
curl -H "Host: carpool.local" http://127.0.0.1:8580/car
[{"car_id":1,"car_type":"mini clubman SD","license_plate":"BO-PR-72"}]
TRAEFIK_PODNAME=$(kubectl -n traefik-v2 get pods -l app.kubernetes.io/name=traefik -o jsonpath="{range .items[*]}{@.metadata.name}{end}")
kubectl -n traefik-v2 port-forward $TRAEFIK_PODNAME 9000:9000 &
# open browser http://127.0.0.1:9000/dashboard/
# or
# cloud instance
IP4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
# notebook
IP4=$(/sbin/ip -o -4 addr list br2 | awk '{print $4}' | cut -d/ -f1
kubectl -n traefik-v2 port-forward $TRAEFIK_PODNAME --address $IP4 9000:9000 &
# open browser http://$IP4:9000/dashboard/