Replies: 1 comment 2 replies
-
Ok, I've gotten it working. Here's what I got: Setup K3D with Traefik's Gateway ImplementationCreate a K3d cluster without Traefik at first: k3d cluster create kdex --port 80:80@loadbalancer --port 443:443@loadbalancer --port 8000:8000@loadbalancer --k3s-arg "--disable=traefik@server:0" Add Traefik helm repository: helm repo add traefik https://traefik.github.io/charts
helm repo update Setup a # https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
deployment:
podAnnotations:
prometheus.io/port: "8082"
prometheus.io/scrape: "true"
gateway:
listeners:
web:
namespacePolicy: All
priorityClassName: system-cluster-critical
providers:
kubernetesGateway:
enabled: true
service:
ipFamilyPolicy: PreferDualStack
tolerations:
- key: CriticalAddonsOnly
operator: Exists
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
operator: Exists
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists Install Traefik using those values: helm upgrade --install --version 32.1.1 --namespace kube-system traefik traefik/traefik -f values.yaml Apply a sample: # Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami-deployment
labels:
app: whoami
spec:
replicas: 1
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- image: docker.io/containous/whoami:v1.5.0
name: whoami
ports:
- containerPort: 80
---
# Service
apiVersion: v1
kind: Service
metadata:
name: whoami-service
spec:
ports:
- name: whoami
port: 80
targetPort: 80
selector:
app: whoami
---
# HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: whoami-httproute
spec:
parentRefs:
- name: traefik-gateway
namespace: kube-system
hostnames:
- whoami.docker.localhost
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: whoami-service
port: 80 Test it out: curl http://whoami.docker.localhost Hopefully this helps someone else that wants to try it out! And also maybe there's a simpler way. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, I'd like to experiment with Gateway API in k3d and I'd wondering how I go about enabling the
kubernetesGateway
provider in traefik.Beta Was this translation helpful? Give feedback.
All reactions