How to to configure Ingress when deploying on K3S with Traefik?
What would you like to be added?
Add values.yaml instructions on how to configure ingress to be set on K3S when using default ingress Traefik.
Why is this needed?
Additional support for Traefik.
I can't figure this out either. Documentation only supports kubectl proxy and all othe examples I find are out of date.
I have managed to expose the dashboard through traefik ingress by ignoring the helm-generated ingress, and disabling kong proxy.
My helm values file
...
kong:
enabled: false
...
Ingress:
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: dashboard-http-redirect
namespace: kube-dashboard
spec:
redirectScheme:
scheme: https
permanent: true
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-http-redirect
namespace: kube-dashboard
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
# MUST be <namespace>-<name>@kubernetescrd
traefik.ingress.kubernetes.io/router.middlewares: kube-dashboard-dashboard-http-redirect@kubernetescrd
spec:
rules:
- host: dashboard-ingress.k3s.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-web
port:
number: 8000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-https
namespace: kube-dashboard
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: dashboard-ingress.k3s.local
http:
paths:
- path: /api/v1/login
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-auth
port:
number: 8000
- path: /api/v1/csrftoken/login
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-auth
port:
number: 8000
- path: /api/v1/me
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-auth
port:
number: 8000
- path: /api
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-api
port:
number: 8000
- path: /metrics
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-api
port:
number: 8000
- path: /
pathType: Prefix
backend:
service:
name: kubernetes-dashboard-web
port:
number: 8000
Please note that i generate three thing in the ingress.
- Middleware that will redirect http to https
- Ingress for the http
- Actual ingress on https
The dashboard cannot be exposed on http. It will work on http, but you will not be able to login. See #9252 and #9448 (in particular https://github.com/kubernetes/dashboard/issues/9448#issuecomment-2337791855)
l0ner this solution worked for me, many thanks! One small change, added the TLS secret from Let's Encrypt...
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-https
namespace: kubernetes-dashboard
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
tls:
- hosts:
- ${kubernetes_dashboard_fqdn}
secretName: kubernetes-dashboard-${kubernetes_dashboard_cloudflare_dns_secret_name_prefix}-${kubernetes_dashboard_issuer_environment}-tls
rules:
- host: ${kubernetes_dashboard_fqdn}
http:
paths:
https://github.com/gitisz/tofu-xen-k3s/blob/main/deployments/kubernetes-dashboard/k8s-dashboard-ingress.yaml#L41-L44
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
I too am interested in a solution for this.
The example provided works, however, does not follow documentations guidance of "users can then use any ingress controller or proxy in front of kong gateway".
- https://artifacthub.io/packages/helm/k8s-dashboard/kubernetes-dashboard
When attempting a basic ingress to point at the kong proxy service itself, a x500 is returned.
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.