Compare commits

..

85 commits
WIP2 ... master

Author SHA1 Message Date
8e5db64b48
Update traefik to version 3.3.6 & helm chart to version 35.0.1 2025-04-19 11:14:34 +02:00
72c1cb7d9f
Update sablier to version 1.9.0 2025-04-12 14:33:13 +02:00
5c42a3ee27
Update traefik helm chart to version 35.0.0 2025-04-12 14:32:07 +02:00
fc93823122
Update versions, traefik: 3.3.5; traefik crds: 1.6.0; traefik helm chart: 34.5.0 2025-04-02 08:27:32 +02:00
cd264348ae
Update sablier to version 1.8.6 2025-03-05 08:07:16 +01:00
3b63848dcc
Update traefik helm chart to version 34.4.1, traefik crds helm chart to 1.5.0 2025-03-05 08:06:58 +01:00
a6846e75ab
Update traefik to version 3.3.4 2025-02-26 08:23:46 +01:00
51c4037041
Update traefik helm chart to version 34.4.0 2025-02-21 23:00:02 +01:00
d234920f99
Update crds chart to version 1.4.0 2025-02-21 22:59:16 +01:00
d54083e105
Update sablier to version 1.8.5 2025-02-21 22:56:39 +01:00
2e723a2e48
Update sablier to version 1.8.3 2025-02-08 13:37:26 +01:00
27f57467e5
Update traefik to version 3.3.3 2025-02-08 13:09:33 +01:00
3072bf1b85
Update traefik helm charts 2025-02-08 13:05:46 +01:00
8e722e7bbd
Update traefik helm charts 2025-01-18 13:21:01 +01:00
7b1dc133bc
Update sablier to version 1.8.2 2025-01-17 08:07:22 +01:00
bfbf42d6ea
Update traefik to version 3.3.1 2025-01-11 09:03:01 +01:00
fdac47a999
Update traefik to version 3.2.3 2024-12-17 06:48:23 +01:00
c6e526a873
Update traefik helm chart to version 33.2.1 2024-12-14 11:01:45 +01:00
c44b244662
Update traefik helm chart to version 33.2.0 2024-12-11 14:56:31 +01:00
8997b36ac9
Update traefik helm chart to version 33.1.0 & traefik to version 3.2.2 2024-12-11 10:38:34 +01:00
d720b16395
Update traefik to version 3.2.1 2024-11-20 22:28:14 +01:00
e55c12a65a
Fix sablier config 2024-11-16 23:57:46 +01:00
b8c2999185
Move external-dns annotation 2024-11-16 13:31:36 +01:00
2fd697e6af
Add comment to enable prometheus rules 2024-11-02 11:47:54 +01:00
d99b5686b5
Update traefik helm chart to version 33.0.0 2024-11-01 15:24:24 +01:00
793b10fbaf
Update traefik to version 3.2.0 2024-10-29 09:31:43 +01:00
c99b0c58ad
Reduce sablier RBAC permission 2024-10-25 09:56:21 +02:00
77a7accd51
Update Sablier to version 1.8.1 2024-10-25 01:20:38 +02:00
474c54804c
Update Sabllier to version 1.8.1 2024-10-21 09:34:25 +02:00
f83fd94ddf
Fix Sablier 2024-10-16 00:39:51 +02:00
ccf7bef5eb
Update traefik helm chart to version 32.1.1 2024-10-11 21:37:49 +02:00
3e53d8fb91
Update traefik to version 3.1.6 2024-10-10 14:53:52 +02:00
dd782d4e32
Update traefik helm chart to version 32.1.0 & traefik to version 3.1.5 2024-10-08 07:18:15 +02:00
0dcdedf829
Update min_security middleware 2024-10-02 09:08:01 +02:00
24d977621b
Add forgotten file 2024-09-28 18:55:56 +02:00
232cd4de5d
Update traefik role 2024-09-28 18:55:34 +02:00
8db2742da0
fix yaml template 2024-09-13 14:16:59 +02:00
62961f7e06
Switch plugin traefik-on-demand by sablier 2024-09-09 00:07:23 +02:00
48c523ec9a
Add servers transport file 2024-09-08 13:47:46 +02:00
6b03163f05
Update traefik to version 3.0.4 2024-07-07 11:19:43 +02:00
f14a292a35
Update ServiceMonitor configuration 2024-06-28 11:28:53 +02:00
8d4a335e40
Enable ServiceMonitor 2024-06-26 23:40:57 +02:00
c5ef11e9e0
Add grafana dashboard 2024-06-26 23:34:24 +02:00
5eaa1c24af
Add link for traefik helm chart 2024-05-04 13:49:52 +02:00
0ff12a846f
Update to traefik v3 2024-05-04 13:39:47 +02:00
a4d8db4653
Add wip for dashboard 2023-11-18 10:13:54 +01:00
dda4c70a95
Fix another lint errors
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-24 12:13:45 +02:00
1be87b3bb4
Fix lint error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-07-24 12:07:32 +02:00
8a6b74906e
Enable http/3
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-07-20 13:15:16 +02:00
37c90c3c42
WIP Switchboard 2023-07-20 13:14:31 +02:00
c96e8274a9
Update traefik to version 2.10.3 2023-07-20 13:14:09 +02:00
23e0c8a91e
Fix hostport deployment
All checks were successful
continuous-integration/drone/push Build is passing
2023-06-23 17:09:22 +02:00
2a2161a25d
Update traefik deployment
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-07 11:24:40 +01:00
4e55bc09af
Update traefik & crowdsec traefik bouncer
All checks were successful
continuous-integration/drone/push Build is passing
2022-10-18 00:18:20 +02:00
382cc69b2c
Update traefik deployment
All checks were successful
continuous-integration/drone/push Build is passing
2022-10-05 11:16:48 +02:00
a102ba09a7
Fix lint errors
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-23 01:07:41 +02:00
44b97e681c
Fix lint errors
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2022-07-23 01:03:23 +02:00
daaed8df51
Fix collections names
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2022-07-16 23:33:49 +02:00
ba1319aeef
Add ondemand plugin
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2022-07-16 23:31:42 +02:00
e76a31ffeb
Traefik-hub deployment
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-24 02:25:41 +02:00
7ced7add47
Update traefik to version 2.7.1 2022-06-24 02:24:02 +02:00
ebc0f4bdfc
Enable plugins
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-15 19:56:54 +02:00
6def4562ad
Update traefik deployment + add crowdsec bouncer
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-05 11:27:24 +02:00
736ac64ff0
Add test with nodeports
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-10 00:35:31 +02:00
eb0b205efb
Update traefik conf
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-04 00:04:09 +02:00
1fccb6896e
Add chain middleware exemple
All checks were successful
continuous-integration/drone/push Build is passing
2022-04-02 11:15:52 +02:00
5456ce68ef
Fix authelia middleware
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-26 00:04:37 +01:00
49f9f0be08
Prepare default backend 2022-03-26 00:04:05 +01:00
34a9cc12e5
Add comment
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 18:11:29 +01:00
c0bfc09c8c
Update role
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-26 00:46:31 +01:00
a5a52b15c8
Fix template
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-25 00:39:05 +01:00
a722a1d783
Use helm template values file 2022-02-25 00:38:43 +01:00
b3df6499f3
Update API 2022-02-25 00:38:10 +01:00
ee4e749cd3
Update traefik deployment
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-31 21:15:56 +01:00
0735682969
Deploy without hostport
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-25 01:56:25 +01:00
288a4454da
Add defaults middleware in comments for future use 2021-12-25 01:55:56 +01:00
917c6bdc26
Update port name 2021-12-25 01:55:08 +01:00
771371672f
Update files provider 2021-12-25 01:54:48 +01:00
50d1adfe4e
Update meta 2021-12-25 01:53:07 +01:00
6e87290774
Update traefik version to 2.4.1
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-01 23:32:03 +01:00
0f90bb8c99
Simplify traefik version management
All checks were successful
continuous-integration/drone/push Build is passing
2021-01-30 11:05:59 +01:00
23413944f5
Fix another lint
All checks were successful
continuous-integration/drone/push Build is passing
2021-01-23 17:36:30 +01:00
f67680e0a0
Fix lint
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-23 17:35:21 +01:00
25e17131ec
fix context
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-23 01:49:17 +01:00
2bb4b4e4a6 Merge pull request 'Use helm, don't manage traefik manifest any more' (#2) from WIP2 into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2
2021-01-18 23:05:54 +00:00
18 changed files with 2419 additions and 202 deletions

View file

@ -1,7 +1,7 @@
--- ---
kind: pipeline kind: pipeline
type: kubernetes type: kubernetes
#type: docker # type: docker
name: default name: default
steps: steps:

View file

@ -1,19 +1,29 @@
my_context: kubernetes my_context: kubernetes
traefik_version: "2.3" traefik_version: "3.3.6"
traefik_domain: "local" traefik_helm_chart_version: "35.0.1"
traefikcrds_helm_chart_version: "1.6.0"
cluster_domain: "local"
traefik_namespace: "traefik" traefik_namespace: "traefik"
#ingress_whitelist: traefik_service_type: LoadBalancer
# ingress_whitelist:
# - 10.96.0.0/12 # - 10.96.0.0/12
# - 10.244.0.0/16 # - 10.244.0.0/16
# - 192.168.0.0/24 # - 192.168.0.0/24
#traefik_node_selector: # traefik_node_selector:
# - localhost # - localhost
traefik_cpu_limit: 500m traefik_cpu_limit: 500m
traefik_memory_limit: 300Mi traefik_memory_limit: 300Mi
traefik_entrypoints: traefik_entrypoints: []
- { name: "http", port: 8000, proto: "TCP", hostport: 80 } # - { name: "http", port: 8000, proto: "TCP", hostport: 80 middlewares: ["{{ traefik_namespace }}-crowdsec-traefik-bouncer@kubernetescrd"] }
- { name: "https", port: 4443, proto: "TCP", hostport: 443, tls: true } # - { name: "https", port: 4443, proto: "TCP", hostport: 443, tls: true middlewares: ["{{ traefik_namespace }}-crowdsec-traefik-bouncer@kubernetescrd"] }
- { name: "traefik", port: 8080, proto: "TCP" } # - { name: "traefik", port: 8080, proto: "TCP" }
# traefik_external_ips: []
# - 1.2.3.4
basic_auth: false basic_auth: false
#traefik_dashboard_certificate: wildcard-cluster # traefik_dashboard_certificate: wildcard-cluster
crowdsec_namespace: "crowdsec"
crowdsec_traefik_bouncer_chart_version: "0.1.3"
traefik_sabblier_version: "1.9.0"

1523
files/grafana-dashboard.yml Normal file

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ galaxy_info:
galaxy_tags: [] galaxy_tags: []
license: GPL2 license: GPL2
collections: collections:
- community.kubernetes - kubernetes.core
platforms: platforms:
- name: kubernetes - name: kubernetes
version: version:

View file

@ -1,7 +1,20 @@
- name: traefik setup - name: traefik setup
block: block:
# - name: Deploy Traefik CRDs
# kubernetes.core.k8s:
# state: present
# context: "{{ my_context }}"
# apply: true
# definition: "{{ lookup('url', item , split_lines=False) | from_yaml_all }}"
# with_items:
## - "https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml"
# - "https://raw.githubusercontent.com/traefik/traefik/v3.2/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml"
## - "https://raw.githubusercontent.com/traefik/traefik/v3.2/docs/content/reference/dynamic-configuration/kubernetes-crd-rbac.yml"
## ansible.builtin.command: >
## kubectl --context "{{ my_context }}" apply --server-side --force-conflicts -k
## https://github.com/traefik/traefik-helm-chart/tree/v{{ traefik_helm_chart_version }}/traefik/crds/
- name: namespace - name: namespace
k8s: kubernetes.core.k8s:
state: present state: present
context: "{{ my_context }}" context: "{{ my_context }}"
merge_type: merge merge_type: merge
@ -9,20 +22,20 @@
api_version: v1 api_version: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: traefik name: '{{ traefik_namespace }}'
labels: labels:
namespace: '{{ traefik_namespace }}' namespace: '{{ traefik_namespace }}'
- name: Create a Secret object for basic authentification - name: Create a Secret object for basic authentification
k8s: kubernetes.core.k8s:
state: present state: present
context: "{{ my_context }}" context: "{{ my_context }}"
namespace: '{{ traefik_namespace }}'
definition: definition:
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: basic-auth name: basic-auth
namespace: '{{ traefik_namespace }}'
type: Opaque type: Opaque
data: data:
basic_auth: "{{ basic_auth_data | b64encode }}" basic_auth: "{{ basic_auth_data | b64encode }}"
@ -30,7 +43,7 @@
- basic_auth|bool - basic_auth|bool
- name: Add host label for traefik deployment - name: Add host label for traefik deployment
k8s: kubernetes.core.k8s:
state: present state: present
context: "{{ my_context }}" context: "{{ my_context }}"
definition: definition:
@ -45,8 +58,36 @@
when: when:
- traefik_node_selector is defined - traefik_node_selector is defined
- name: Deploy latest version of CrowdSec Traefik bouncer
kubernetes.core.helm:
context: "{{ my_context }}"
name: crowdsec-traefik-bouncer
release_namespace: "{{ traefik_namespace }}"
create_namespace: true
chart_ref: crowdsec/crowdsec-traefik-bouncer
chart_version: "{{ crowdsec_traefik_bouncer_chart_version }}"
values:
image:
tag: "0.5.0"
bouncer:
crowdsec_bouncer_api_key: "{{ traefik_crowdsec_bouncer_apikey }}"
crowdsec_agent_host: "crowdsec-service.{{ crowdsec_namespace }}.svc.cluster.local:8080"
crowdsec_bouncer_gin_mode: "release"
replicaCount: 1
podSecurityContext:
fsGroup: 2000
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
when:
- traefik_crowdsec_bouncer_apikey is defined
# - name: Get Deployment information object # - name: Get Deployment information object
# k8s_info: # kubernetes.core.k8s_info:
# context: "{{ my_context }}" # context: "{{ my_context }}"
# api_version: v1 # api_version: v1
# kind: DaemonSet # kind: DaemonSet
@ -57,11 +98,11 @@
# register: traefik_actual_resources # register: traefik_actual_resources
# #
# - name: Retreive actual traefik version # - name: Retreive actual traefik version
# shell: echo "{{ traefik_actual_resources.resources }}" | sed "s/.*traefik:\([0-9]\.[0-9]*\).*/\1/" | uniq # ansible.builtin.shell: echo "{{ traefik_actual_resources.resources }}" | sed "s/.*traefik:\([0-9]\.[0-9]*\).*/\1/" | uniq
# register: traefik_actual_version # register: traefik_actual_version
# #
# - name: Remove old traefik version {{ traefik_actual_version.stdout }} # - name: Remove old traefik version {{ traefik_actual_version.stdout }}
# k8s: # kubernetes.core.k8s:
# state: "absent" # state: "absent"
# context: "{{ my_context }}" # context: "{{ my_context }}"
# resource_definition: "{{ lookup('template', item) | from_yaml }}" # resource_definition: "{{ lookup('template', item) | from_yaml }}"
@ -73,62 +114,144 @@
# - not traefik_version == traefik_actual_version.stdout # - not traefik_version == traefik_actual_version.stdout
# - traefik_actual_version.stdout is version(traefik_version, '>') # - traefik_actual_version.stdout is version(traefik_version, '>')
# https://github.com/traefik/traefik-helm-chart
- name: Defined traefik repository - name: Defined traefik repository
community.kubernetes.helm_repository: kubernetes.core.helm_repository:
name: traefik name: traefik
repo_url: "https://helm.traefik.io/traefik" repo_url: "https://helm.traefik.io/traefik"
tags: traefik - name: Deploy Traefik CRDs
kubernetes.core.helm:
context: "{{ my_context }}"
name: traefik-crds
chart_ref: traefik/traefik-crds
chart_version: "{{ traefikcrds_helm_chart_version }}"
release_namespace: "{{ traefik_namespace }}"
create_namespace: true
# - name: show templating results
# ansible.builtin.debug:
# msg: "{{ lookup('ansible.builtin.template', 'traefik-helm-value.yaml.j2') }}"
- name: Deploy latest version of Traefik - name: Deploy latest version of Traefik
community.kubernetes.helm: kubernetes.core.helm:
context: "{{ my_context }}"
name: traefik name: traefik
chart_ref: traefik/traefik chart_ref: traefik/traefik
release_namespace: traefik chart_version: "{{ traefik_helm_chart_version }}"
values: release_namespace: "{{ traefik_namespace }}"
image: create_namespace: true
tag: "{{ traefik_version_2_3 }}" skip_crds: true
additionalArguments: values: "{{ lookup('template', 'traefik-helm-value.yaml.j2') | from_yaml }}"
- --configFile=/etc/traefik/traefik.yaml
podSecurityPolicy:
enabled: true
service:
enabled: false
ingressRoute:
dashboard:
enabled: false
ingressClass:
enabled: true
isDefaultClass: true
ports:
web:
redirectTo: websecure
hostPort: 80
websecure:
hostPort: 443
volumes:
- mountPath: /etc/traefik
name: traefik-conf
type: configMap
- mountPath: /etc/traefik/file
name: traefik-files
type: configMap
- mountPath: /etc/traefik/basic-auth
name: basic-auth
type: secret
- name: Install traefik configuration - name: Install traefik configuration
k8s: kubernetes.core.k8s:
state: "present" state: "present"
context: "{{ my_context }}" context: "{{ my_context }}"
namespace: '{{ traefik_namespace }}' namespace: '{{ traefik_namespace }}'
# merge_type: merge # merge_type: merge
apply: yes apply: true
resource_definition: "{{ lookup('template', item) | from_yaml }}" resource_definition: "{{ lookup('template', item) | from_yaml_all }}"
with_items: with_items:
- default-network-dns-policy.yaml.j2
# - "{{ lookup('vars', 'traefik_' + traefik_version | regex_replace('[.]','_') + '_list') }}" # - "{{ lookup('vars', 'traefik_' + traefik_version | regex_replace('[.]','_') + '_list') }}"
- traefik-certificate.yml.j2
- traefik-cm.yml.j2 - traefik-cm.yml.j2
- traefik-files.yml.j2 - traefik-files.yml.j2
# - traefik-sa.yml.j2 # - traefik-sa.yml.j2
- traefik-ingressroute.yml.j2 - traefik-ingressroute.yml.j2
- traefik-svc.yml.j2 # - traefik-svc.yml.j2
# - traefik-defaultbackend.yml.j2
- name: Install traefik plugin's
kubernetes.core.k8s:
state: "present"
context: "{{ my_context }}"
namespace: '{{ traefik_namespace }}'
# merge_type: merge
apply: true
resource_definition: "{{ lookup('template', item) | from_yaml_all }}"
with_items:
- traefik-ondemand-plugin.yml.j2
when:
- traefik_ondemand is defined
- name: ReInstall traefik-hub certificate if already know
kubernetes.core.k8s:
state: "present"
context: "{{ my_context }}"
namespace: '{{ traefik_namespace }}'
# merge_type: merge
# apply: true
resource_definition: "{{ lookup('template', item) | from_yaml_all }}"
with_items:
- traefik-hub-certificate.yml.j2
when:
- traefik_hub_tlscrt is defined
- traefik_hub_tlskey is defined
- name: Defined traefik-hub repository
kubernetes.core.helm_repository:
name: traefik-hub
repo_url: "https://helm.traefik.io/hub"
when:
- traefik_hub_token is defined
- name: Deploy latest version of Traefik-hub
kubernetes.core.helm:
context: "{{ my_context }}"
name: hub-agent
chart_ref: traefik-hub/hub-agent
release_namespace: "{{ traefik_namespace }}"
values:
token: "{{ traefik_hub_token }}"
when:
- traefik_hub_token is defined
# echo 'apiVersion: v1
# kind: Service
# metadata:
# annotations:
# # external-dns.alpha.kubernetes.io/endpoints-type: HostIP
# external-dns.alpha.kubernetes.io/hostname: traefik.ibm.reslinger.net
# external-dns.alpha.kubernetes.io/endpoints-type: NodeExternalIP
# # external-dns.alpha.kubernetes.io/target: "1.2.3.4"
# name: traefik-dns
# namespace: traefik
# spec:
# clusterIP: None
# ports:
# - name: web
# port: 80
# protocol: TCP
# targetPort: web
# - name: websecure
# port: 443
# protocol: TCP
# targetPort: websecure
# selector:
# app.kubernetes.io/instance: traefik-traefik
# app.kubernetes.io/name: traefik' | kubectl --context kubeibm -n traefik apply -f -
# - name: Deploy latest version of Switchboard
# kubernetes.core.helm:
# context: "{{ my_context }}"
# name: switchboard
# chart_ref: oci://ghcr.io/borchero/charts/switchboard
# release_namespace: "{{ traefik_namespace }}"
# # values: "{{ lookup('template', 'traefik-helm-value.yaml.j2') | from_yaml }}"
# values:
# integrations:
# # certManager:
# # enabled: true
# # issuer: "letsencrypt-prod"
# externalDNS:
# enabled: true
# targetIPs: [10.144.217.172]
- name: Install traefik grafana dashboard
kubernetes.core.k8s:
state: "present"
context: "{{ my_context }}"
namespace: 'traefik'
apply: yes
resource_definition: "{{ lookup('file', item) | from_yaml_all }}"
with_items:
- grafana-dashboard.yml
tags: traefik tags: traefik

View file

@ -0,0 +1,46 @@
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: intra-namespace
spec:
podSelector: {}
ingress:
- from:
- namespaceSelector:
matchLabels:
name: {{ traefik_namespace }}
#---
#apiVersion: networking.k8s.io/v1
#kind: NetworkPolicy
#metadata:
# name: allow-dns-access
#spec:
# podSelector:
# matchLabels: {}
# policyTypes:
# - Egress
# egress:
# - to:
# - namespaceSelector:
# matchLabels:
# kubernetes.io/metadata.name: kube-system
# podSelector:
# matchLabels:
# k8s-app: kube-dns
# ports:
# - protocol: UDP
# port: 53
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-all-traefik-v121-ingress
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: traefik
ingress:
- {}
policyTypes:
- Ingress

View file

@ -0,0 +1,12 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: traefik.{{ cluster_domain }}
spec:
dnsNames:
- traefik.{{ cluster_domain }}
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
secretName: traefik.{{ cluster_domain }}

View file

@ -15,49 +15,111 @@ data:
web: web:
address: ":8000/tcp" address: ":8000/tcp"
http: http:
# middlewares:
# - auth@file
# - secure_headers@file
# - crowdsec-bouncer@file
# - {{ traefik_namespace }}-crowdsec-traefik-bouncer@kubernetescrd
redirections: redirections:
entryPoint: entryPoint:
to: websecure to: websecure
scheme: https scheme: https
permanent: true
websecure: websecure:
address: ":8443/tcp" address: ":8443"
http: http:
tls: tls:
options: default options: default
# middlewares:
# - auth@file
# - secure_headers@file
# - crowdsec-bouncer@file
http3:
advertisedPort: 443
traefik: traefik:
address: ":9000/tcp" address: ":8080/tcp"
metrics:
address: ":9100/tcp"
{% if traefik_hub_token is defined %}
traefikhub-api:
address: ":9900"
traefikhub-tunl:
address: ":9901/tcp"
{% endif%}
{% for traefik_entrypoint in traefik_entrypoints %} {% for traefik_entrypoint in traefik_entrypoints %}
{{ traefik_entrypoint.name }}: {{ traefik_entrypoint.name }}:
address: :{{ traefik_entrypoint.port }} {% if traefik_entrypoint.proto is defined %}
{% if traefik_entrypoint.tls is defined and traefik_entrypoint.tls|bool %} address: ":{{ traefik_entrypoint.port }}/{{ traefik_entrypoint.proto | lower }}"
{% else %}
address: ":{{ traefik_entrypoint.port }}"
{% endif %}
{% if traefik_entrypoint.tls is defined or traefik_entrypoint.middlewares is defined %}
http: http:
{% if traefik_entrypoint.middlewares is defined %}
middlewares:
{% for middleware in traefik_entrypoint.middlewares %}
- {{ middleware }}
{% endfor %}
{% endif %}
{% if traefik_entrypoint.tls is defined and traefik_entrypoint.tls|bool %}
tls: {} tls: {}
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
providers: providers:
kubernetesCRD: kubernetesCRD:
# ingressClass: "traefik" # ingressClass: "traefik"
throttleDuration: 2s throttleDuration: 2s
{% if traefik_ondemand is defined %}
allowEmptyServices: true
{% endif%}
kubernetesIngress: kubernetesIngress:
ingressClass: "traefik" ingressClass: "traefik"
{% if traefik_hub_token is defined %}
allowExternalNameServices: true
{% endif%}
{% if traefik_ondemand is defined %}
allowEmptyServices: true
{% endif%}
kubernetesGateway: {}
file: file:
directory: /etc/traefik/file/ directory: /etc/traefik/file/
watch: true watch: true
metrics: metrics:
prometheus: prometheus:
entryPoint: traefik entryPoint: metrics
addRoutersLabels: true
ping: ping:
entryPoint: traefik entryPoint: traefik
api: api:
dashboard: true dashboard: true
{% if traefik_hub_token is defined %}
hub: {}
{% endif %}
log: log:
level: WARN level: ERROR
format: json # format: json
accessLog: accessLog: {}
format: json #accessLog:
fields: # filePath: "/var/log/traefik/access.log"
names: # bufferingSize: 50
BackendAddr: keep ## format: json
BackendName: keep ## fields:
BackendURL: keep ## names:
FrontendName: keep ## BackendAddr: keep
## BackendName: keep
## BackendURL: keep
## FrontendName: keep
{% if traefik_hub_token is defined or traefik_ondemand is defined %}
experimental:
# kubernetesGateway: true
{% if traefik_hub_token is defined %}
hub: true
{% endif %}
{% if traefik_ondemand is defined %}
plugins:
sablier:
moduleName: github.com/sablierapp/sablier
version: v{{ traefik_sabblier_version }}
{% endif %}
{% endif %}

View file

@ -0,0 +1,16 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cheese
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
traefik.ingress.kubernetes.io/router.priority: "1"
traefik.ingress.kubernetes.io/router.middlewares: security_headers@file,compress@file
spec:
defaultBackend:
service:
name: stilton
port:
number: 80

View file

@ -7,6 +7,21 @@ data:
traefik-middlewares.yaml: | traefik-middlewares.yaml: |
http: http:
middlewares: middlewares:
min_security:
chain:
middlewares:
- security_headers
{% if ingress_whitelist is defined %}
- traefik-ipwhitelist
{% endif %}
- rate-limit
- compress
{% if false %}
{% if basic_auth|bool %}
- basic-auth
{% endif %}
- authelia
{% endif %}
compress: compress:
compress: compress:
excludedContentTypes: ["text/event-stream"] excludedContentTypes: ["text/event-stream"]
@ -17,7 +32,7 @@ data:
security_headers: security_headers:
headers: headers:
accessControlAllowMethods: ["GET", "OPTIONS", "PUT"] accessControlAllowMethods: ["GET", "OPTIONS", "PUT"]
accessControlAllowOrigin: "origin-list-or-null" # accessControlAllowOrigin: "origin-list-or-null"
accessControlMaxAge: 100 accessControlMaxAge: 100
addVaryHeader: true addVaryHeader: true
browserXssFilter: true browserXssFilter: true
@ -28,13 +43,15 @@ data:
stsPreload: true stsPreload: true
customFrameOptionsValue: "SAMEORIGIN" customFrameOptionsValue: "SAMEORIGIN"
referrerPolicy: "same-origin" referrerPolicy: "same-origin"
featurePolicy: "vibrate 'self'" # permissionsPolicy: "vibrate 'self'"
permissionsPolicy: "camera 'none'; microphone 'none'; geolocation 'none'; payment 'none';"
stsSeconds: 315360000 stsSeconds: 315360000
sslRedirect: true # contentSecurityPolicy: "default-src 'self' 'unsafe-inline'"
contentSecurityPolicy: "default-src 'self' 'unsafe-inline'"
# customResponseHeaders: # customResponseHeaders:
# X-Robots-Tag: "none,noarchive,nosnippet,notranslate,noimageindex," # X-Robots-Tag: "none,noarchive,nosnippet,notranslate,noimageindex,"
# server: "" # server: ""
hostsProxyHeaders:
- "X-Forwarded-Host"
{% if ingress_whitelist is defined %} {% if ingress_whitelist is defined %}
traefik-ipwhitelist: traefik-ipwhitelist:
ipWhiteList: ipWhiteList:
@ -43,6 +60,19 @@ data:
- {{ acl_whitelist }} - {{ acl_whitelist }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if traefik_ondemand is defined %}
ondemand:
plugin:
sablier:
#group: default
dynamic:
displayName: Application is starting
refreshFrequency: 5s
showDetails: "true"
theme: hacker-terminal
sablierUrl: http://sablier:10000
sessionDuration: 1m
{% endif %}
{% if basic_auth|bool %} {% if basic_auth|bool %}
basic-auth: basic-auth:
basicAuth: basicAuth:
@ -55,7 +85,30 @@ data:
forwardAuth: forwardAuth:
address: "http://authelia:9091/api/verify?rd=https://login.example.com/" address: "http://authelia:9091/api/verify?rd=https://login.example.com/"
trustForwardHeader: true trustForwardHeader: true
authReponseHeaders: ["Remote-User", "Remote-Groups", "Remote-Name", "Remote-Email"] authResponseHeaders:
- "Remote-User"
- "Remote-Groups"
- "Remote-Name"
- "Remote-Email"
authelia-basic:
forwardAuth:
address: "http://authelia:9091/api/verify?auth=basic"
trustForwardHeader: true
authResponseHeaders:
- "Remote-User"
- "Remote-Groups"
- "Remote-Name"
- "Remote-Email"
crowdsec-bouncer:
forwardAuth:
address: "http://crowdsec-traefik-bouncer-service/api/v1/forwardAuth"
trustForwardHeader: true
traefik-servers-transport.yaml: |
http:
serversTransports:
skip-verify-https-backend:
insecureSkipVerify: true
traefik-tls-defaults-options.yaml: | traefik-tls-defaults-options.yaml: |
tls: tls:
@ -70,3 +123,33 @@ data:
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
alpnProtocols:
- h2
- http/1.1
{% if false %}
stores:
default:
defaultCertificate:
certFile: path/to/wildcardcert.crt
keyFile: path/to/wildcardcert.key
certificates:
- certFile: /path/to/domain.cert
keyFile: /path/to/domain.key
- certFile: /path/to/other-domain.cert
keyFile: /path/to/other-domain.key
{% endif %}
# dashboard.yaml: |
# http:
# routers:
# traefik:
# rule: "Host(`traefik.{{ domain | lower }}`)"
# entryPoints:
# - "websecure"
# middlewares:
# - "min_security@file"
#{% if basic_auth|bool %}
# - "basic-auth@file"
#{% endif %}
# service: "api@internal"

View file

@ -0,0 +1,184 @@
# https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
{% if traefik_version is defined %}
image:
tag: "{{ traefik_version }}"
{% endif %}
#fullnameOverride: "{{ my_context }}"
additionalArguments:
- --configFile=/etc/traefik/traefik.yaml
#podSecurityPolicy:
# enabled: true
service:
type: {{ traefik_service_type }}
{% if traefik_external_ips is defined %}
externalIPs:
{% for external_ip in traefik_external_ips %}
- {{ external_ip }}
{% endfor %}
{% endif %}
{% if traefik_service_type == "LoadBalancer" %}
annotations:
external-dns.alpha.kubernetes.io/hostname: traefik.{{ cluster_domain }}
{% endif %}
ingressRoute:
dashboard:
enabled: false
podDisruptionBudget:
enabled: true
minAvailable: 1
ingressClass:
enabled: true
isDefaultClass: true
{% if false %}
autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 60
- type: Resource
resource:
name: memory
targetAverageUtilization: 60
{% endif %}
{% if traefik_service_type == "NodePort" or (traefik_hostport is defined and traefik_hostport == true) or traefik_hub_token is defined %}
ports:
{% if traefik_service_type == "NodePort" or (traefik_hostport is defined and traefik_hostport == true) %}
web:
# redirectTo: websecure
{% if traefik_hostport is defined and traefik_hostport == true %}
hostPort: 80
{% endif %}
{% if traefik_service_type == "NodePort" %}
nodePort: 80
{% endif %}
websecure:
{% if traefik_hostport is defined and traefik_hostport == true %}
hostPort: 443
{% endif %}
{% if traefik_service_type == "NodePort" %}
nodePort: 443
{% endif %}
http3:
enabled: true
advertisedPort: 443
# tls:
# enabled: true
# options: default
{% endif %}
{% if traefik_hub_token is defined %}
traefikhub-tunl:
port: 9901
expose: true
exposedPort: 9901
protocol: "TCP"
{% endif %}
{% endif %}
volumes:
- mountPath: /etc/traefik
name: traefik-conf
type: configMap
- mountPath: /etc/traefik/file
name: traefik-files
type: configMap
- mountPath: /etc/traefik/basic-auth
name: basic-auth
type: secret
deployment:
{% if traefik_hostport is defined and traefik_hostport == true %}
kind: DaemonSet
{% else %}
replicas: 1
{% endif %}
revisionHistoryLimit: 3
# podAnnotations:
# prometheus.io/port: '9100'
# prometheus.io/scrape: 'true'
# prometheus.io/path: "/metrics"
{% if traefik_hostport is defined and traefik_hostport == true %}
updateStrategy:
type: OnDelete
{% endif %}
metrics:
prometheus:
service:
enabled: true
serviceMonitor:
metricRelabelings: []
# # - sourceLabels: [__name__]
# # separator: ;
# # regex: ^fluentd_output_status_buffer_(oldest|newest)_.+
# # replacement: $1
# # action: drop
relabelings: []
# # - sourceLabels: [__meta_kubernetes_pod_node_name]
# # separator: ;
# # regex: ^(.*)$
# # targetLabel: nodename
# # replacement: $1
# # action: replace
# jobLabel: traefik
# interval: 30s
# honorLabels: true
# # (Optional)
# # scrapeTimeout: 5s
# # honorTimestamps: true
# # enableHttp2: true
# # followRedirects: true
# # additionalLabels:
# # foo: bar
# # namespace: "another-namespace"
# # namespaceSelector: {}
# prometheusRule:
# enabled: true
# additionalLabels: {}
# namespace: "{{ traefik_namespace }}"
# rules:
# - alert: TraefikDown
# expr: up{job="traefik"} == 0
# for: 5m
# labels:
# context: traefik
# severity: warning
# annotations:
# summary: "Traefik Down"
# description: "{% raw %}{{ $labels.pod }} on {{ $labels.nodename }} is down{% endraw %}"
experimental:
{% if traefik_ondemand is defined %}
plugins:
sablier:
moduleName: "github.com/sablierapp/sablier"
version: "v1.8.1"
{% endif %}
{% if traefik_hub_token is defined %}
hub:
enabled: true
{% endif %}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
{% if false %}
{% raw %}
extraObjects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: "extra"
data:
something: "extra"
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: "templated"
data:
something: {{ printf "templated" }}
{% endraw %}
{% endif %}

View file

@ -0,0 +1,14 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Secret
metadata:
annotations:
app.kubernetes.io/managed-by: traefik-hub
name: hub-certificate
namespace: {{ traefik_namespace }}
type: kubernetes.io/tls
data:
tls.crt: {{ traefik_hub_tlscrt | b64encode }}
tls.key: {{ traefik_hub_tlskey | b64encode }}

View file

@ -1,18 +1,29 @@
apiVersion: traefik.containo.us/v1alpha1 apiVersion: traefik.io/v1alpha1
kind: IngressRoute kind: IngressRoute
metadata: metadata:
name: traefik name: traefik
labels: labels:
app: traefik app: traefik
annotations:
kubernetes.io/ingress.class: traefik
{% if false %}
external-dns.alpha.kubernetes.io/hostname: traefik.{{ cluster_domain }}
external-dns.alpha.kubernetes.io/endpoints-type: NodeExternalIP
# external-dns.alpha.kubernetes.io/endpoints-type: HostIP
# external-dns.alpha.kubernetes.io/target: "1.2.3.4"
# external-dns.alpha.kubernetes.io/ttl: "120"
# external-dns.alpha.kubernetes.io/cloudflare-proxied: "true"
{% endif %}
spec: spec:
entryPoints: entryPoints:
- https - websecure
routes: routes:
# Match is the rule corresponding to an underlying router. # Match is the rule corresponding to an underlying router.
# Later on, match could be the simple form of a path prefix, e.g. just "/bar", # Later on, match could be the simple form of a path prefix, e.g. just "/bar",
# but for now we only support a traefik style matching rule. # but for now we only support a traefik style matching rule.
- match: Host(`traefik.{{ traefik_domain }}`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`)) - match: Host(`traefik.{{ cluster_domain }}`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
# kind could eventually be one of "Rule", "Path", "Host", "Method", "Header", # kind could eventually be one of "Rule", "Path", "Host", "Method", "Header",
# "Parameter", etc, to support simpler forms of rule matching, but for now we # "Parameter", etc, to support simpler forms of rule matching, but for now we
# only support "Rule". # only support "Rule".
@ -20,29 +31,31 @@ spec:
{% if basic_auth is defined or ingress_whitelist is defined %} {% if basic_auth is defined or ingress_whitelist is defined %}
middlewares: middlewares:
{% if ingress_whitelist is defined %} {% if ingress_whitelist is defined %}
- name: traefik-ipwhitelist - name: traefik-ipwhitelist@file
{% endif %} {% endif %}
{% if basic_auth is defined %} {% if basic_auth is defined %}
- name: basic-auth - name: basic-auth@file
{% endif %} {% endif %}
{% endif %} {% endif %}
services: services:
- name: api@internal - name: api@internal
kind: TraefikService kind: TraefikService
- match: Host(`traefik.{{ traefik_domain }}`) && PathPrefix(`/ping`) - match: Host(`traefik.{{ cluster_domain }}`) && PathPrefix(`/ping`)
kind: Rule kind: Rule
services: services:
- name: ping@internal - name: ping@internal
kind: TraefikService kind: TraefikService
- match: Host(`traefik.{{ traefik_domain }}`) && PathPrefix(`/metrics`) # - match: Host(`traefik.{{ cluster_domain }}`) && PathPrefix(`/metrics`)
kind: Rule # kind: Rule
services: # services:
- name: prometheus@internal # - name: prometheus@internal
kind: TraefikService # kind: TraefikService
tls: tls:
{% if traefik_dashboard_certificate is defined %} {% if traefik_dashboard_certificate is defined %}
secretName: {{ traefik_dashboard_certificate }} secretName: {{ traefik_dashboard_certificate }}
{% else %}
secretName: traefik.{{ cluster_domain }}
{% endif %} {% endif %}

View file

@ -1,12 +0,0 @@
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: traefik-ipwhitelist
spec:
ipWhiteList:
sourceRange:
{% if ingress_whitelist is defined %}
{% for acl_whitelist in ingress_whitelist %}
- {{ acl_whitelist }}
{% endfor %}
{% endif %}

View file

@ -0,0 +1,134 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sablier
labels:
app.kubernetes.io/name: sablier
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: sablier
template:
metadata:
labels:
app.kubernetes.io/name: sablier
spec:
serviceAccountName: sablier
serviceAccount: sablier
containers:
- name: sablier
image: sablierapp/sablier:{{ traefik_sabblier_version }}
args:
- "start"
- "--provider.name=kubernetes"
- "--server.port=10000"
- "--storage.file=/dev/shm/state.json"
ports:
- containerPort: 10000
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: true
seccompProfile:
type: RuntimeDefault
securityContext:
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
# --configFile=path/to/myconfigfile.yml
---
apiVersion: v1
kind: Service
metadata:
name: sablier
spec:
selector:
app.kubernetes.io/name: sablier
ports:
- protocol: TCP
port: 10000
targetPort: 10000
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sablier
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: sablier
# namespace: {{ traefik_namespace }}
rules:
- apiGroups:
- apps
- ""
resources:
- deployments
- statefulsets
verbs:
- get # Retrieve info about specific dep
- list # Events
- watch # Events
- apiGroups:
- apps
- ""
resources:
- deployments/scale
- statefulsets/scale
verbs:
- patch # Scale up and down
- get # Retrieve info about specific dep
- update # Scale up and down
- list # Events
- watch # Events
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sablier
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: sablier
subjects:
- kind: ServiceAccount
name: sablier
namespace: {{ traefik_namespace }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-traefik-to-sablier
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: sablier
ingress:
- ports:
- port: 10000
from:
- podSelector:
matchLabels:
app.kubernetes.io/name: traefik
policyTypes:
- Ingress
#---
#apiVersion: traefik.io/v1alpha1
#kind: Middleware
#metadata:
# name: ondemand
#spec:
# plugin:
# names: toto # Comma separated names of containers/services/deployments etc.
# group: default # Group name to use to filter by label, ignored if names is set
# dynamic:
# displayName: My Title # (Optional) Defaults to the middleware name
# refreshFrequency: 5s # (Optional) The loading page refresh frequency
# showDetails: "true" # (Optional) Set to true or false to show details specifcally for this middleware, unset to use Sablier server defaults
# theme: hacker-terminal # (Optional) The theme to use
# sablierUrl: http://sablier.{{ traefik_namespace }}:10000 # The sablier URL service, must be reachable from the Traefik instance
# sessionDuration: 1m # The session duration after which containers/services/deployments instances are shutdown

View file

@ -9,15 +9,23 @@ metadata:
spec: spec:
ports: ports:
- name: web - name: web
hostPort: 80
port: 80 port: 80
protocol: TCP protocol: TCP
targetPort: web targetPort: web
- name: websecure - name: websecure
hostPort: 443
port: 443 port: 443
protocol: TCP protocol: TCP
targetPort: websecure targetPort: websecure
- name: websecure-http3
port: 443
protocol: UDP
targetPort: websecure
{% if traefik_external_ips is defined %}
externalIPs:
{% for traefik_external_ip in traefik_external_ips %}
- {{ traefik_external_ip }}
{% endfor %}
{% endif %}
selector: selector:
app.kubernetes.io/instance: traefik app.kubernetes.io/instance: traefik
app.kubernetes.io/name: traefik app.kubernetes.io/name: traefik

12
todo.sh Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
cat << 'EOF' | kubectl --context my_context apply -f -
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: traefik
spec:
controller: traefik.io/ingress-controller
EOF

View file

@ -1,12 +1 @@
---
traefik_version_2_3: 2.3.7
traefik_2_3_list:
- 2.3/traefik-crd-ingressroutes.yml.j2
- 2.3/traefik-crd-ingressroutetcps.yml.j2
- 2.3/traefik-crd-ingressrouteudps.yml.j2
- 2.3/traefik-crd-middlewares.yml.j2
- 2.3/traefik-crd-tlsoptions.yml.j2
- 2.3/traefik-crd-tlsstores.yml.j2
- 2.3/traefik-crd-traefikservices.yml.j2
- 2.3/traefik-clusterrole.yml.j2
- 2.3/traefik-clusterrolebinding.yml.j2