External Resources
Connecting to external resources#
You can use traefik installed inside a k3s cluster as a reverse proxy for resources hosted outside k3s using endpoint-slices. You’ll need three manifests per resource; a service, and endpoint-slice, and an ingress. As an example, if you want to connect your proxmox dashboard, do this-
Create a
svc.yml:--- apiVersion: v1 kind: Service metadata: name: proxmox namespace: default annotations: traefik.ingress.kubernetes.io/service.serversscheme: https # Needed for https only traefik.ingress.kubernetes.io/service.serverstransport: default-insecure-transport@kubernetescrd # Needed for https only spec: ports: - name: https port: 8006 targetPort: 8006 protocol: TCP clusterIP: None # This is importantCreate a
servers-transport.yml:--- apiVersion: traefik.io/v1alpha1 kind: ServersTransport metadata: name: insecure-transport namespace: default spec: insecureSkipVerify: trueNOTE- The
servers-transport.ymlmanifest is only needed if the resource you want to expose uses https.Create an
endpoint-slice.yml:--- apiVersion: discovery.k8s.io/v1 kind: EndpointSlice metadata: name: proxmox namespace: default labels: kubernetes.io/service-name: proxmox # Should match service name addressType: IPv4 endpoints: - addresses: - 192.168.1.113 # Replace this with the IP of your proxmox server ports: - name: https protocol: TCP port: 8006Create an
ingress.yml:--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: proxmox-ingress namespace: default annotations: cert-manager.io/cluster-issuer: letsencrypt-cloudflare traefik.ingress.kubernetes.io/router.middlewares: tools-authelia@kubernetescrd traefik.ingress.kubernetes.io/router.entrypoints: websecure spec: ingressClassName: traefik tls: - hosts: - proxmox.example.com secretName: proxmox-tls rules: - host: proxmox.example.com http: paths: - path: / pathType: Prefix backend: service: name: proxmox port: number: 8006