Skip to content

Commit

Permalink
Upgrade to traefik v3 by deleting traefik provided by k3s and using t…
Browse files Browse the repository at this point in the history
…raefik's helm chart

k3s-io/k3s#10526
  • Loading branch information
abelfodil committed Dec 28, 2024
1 parent d4311b3 commit c5d7d56
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
55 changes: 29 additions & 26 deletions kubernetes/core/templates/traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,39 @@ type: Opaque
# stringData:
# credentials: "admin:$2y$12$8KtQ4SQb6QpebcgYvMPjwOv3Jz9ojkNq8FVWZmk5q1BW9BoEX2aAy" # admin:admin by default, bcrypted password: https://bcrypt-generator.com/

---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: cluster-admin-authentication
namespace: kube-system
spec:
basicAuth:
secret: "cluster-admin-credentials"

---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: traefik-websecure
namespace: kube-system
spec:
headers:
browserXssFilter: true
stsPreload: true
stsIncludeSubdomains: true
forceSTSHeader: true
stsSeconds: 15552000

---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
kind: HelmChart
metadata:
name: traefik
namespace: kube-system
spec:
chart: traefik
repo: https://traefik.github.io/charts
version: v33.2.1
targetNamespace: kube-system
valuesContent: |-
extraObjects:
- apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: cluster-admin-authentication
namespace: kube-system
spec:
basicAuth:
secret: "cluster-admin-credentials"
- apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: traefik-websecure
namespace: kube-system
spec:
headers:
browserXssFilter: true
stsPreload: true
stsIncludeSubdomains: true
forceSTSHeader: true
stsSeconds: 15552000
logs:
access:
enabled: true
Expand All @@ -56,7 +57,6 @@ spec:
- "true"
globalArguments:
- "--global.sendanonymoususage=false"
- "--entryPoints.websecure.transport.respondingTimeouts.readTimeout=0"
ingressRoute:
dashboard:
enabled: true
Expand All @@ -80,6 +80,9 @@ spec:
redirectTo:
port: websecure
websecure:
transport:
respondingTimeouts:
readTimeout: 0
middlewares:
- kube-system-traefik-websecure@kubernetescrd
tls:
Expand Down
1 change: 1 addition & 0 deletions roles/kubernetes_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
etcd-s3: true
etcd-s3-config-secret: k3s-etcd-snapshot-s3-config
etcd-snapshot-retention: 20
disable: traefik
secrets-encryption: true
with-node-id: true
node-ip: "{{ advertised_ip }}"
Expand Down

0 comments on commit c5d7d56

Please sign in to comment.