Kubernetes Configuration Reference

Dynamic configuration with Kubernetes Custom Resource

  1. apiVersion: apiextensions.k8s.io/v1beta1
  2. kind: CustomResourceDefinition
  3. metadata:
  4. name: ingressroutes.traefik.containo.us
  5. spec:
  6. group: traefik.containo.us
  7. version: v1alpha1
  8. names:
  9. kind: IngressRoute
  10. plural: ingressroutes
  11. singular: ingressroute
  12. scope: Namespaced
  13. ---
  14. apiVersion: apiextensions.k8s.io/v1beta1
  15. kind: CustomResourceDefinition
  16. metadata:
  17. name: middlewares.traefik.containo.us
  18. spec:
  19. group: traefik.containo.us
  20. version: v1alpha1
  21. names:
  22. kind: Middleware
  23. plural: middlewares
  24. singular: middleware
  25. scope: Namespaced
  26. ---
  27. apiVersion: apiextensions.k8s.io/v1beta1
  28. kind: CustomResourceDefinition
  29. metadata:
  30. name: tlsoptions.traefik.containo.us
  31. spec:
  32. group: traefik.containo.us
  33. version: v1alpha1
  34. names:
  35. kind: TLSOption
  36. plural: tlsoptions
  37. singular: tlsoption
  38. scope: Namespaced
  39. ---
  40. apiVersion: apiextensions.k8s.io/v1beta1
  41. kind: CustomResourceDefinition
  42. metadata:
  43. name: ingressroutetcps.traefik.containo.us
  44. spec:
  45. group: traefik.containo.us
  46. version: v1alpha1
  47. names:
  48. kind: IngressRouteTCP
  49. plural: ingressroutetcps
  50. singular: ingressroutetcp
  51. scope: Namespaced
  52. ---
  53. apiVersion: traefik.containo.us/v1alpha1
  54. kind: IngressRoute
  55. metadata:
  56. name: ingressroute
  57. spec:
  58. entryPoints:
  59. - web
  60. - web-secure
  61. routes:
  62. - match: Host(`foo.com`) && PathPrefix(`/bar`)
  63. kind: Rule
  64. priority: 12
  65. # defining several services is possible and allowed, but for now the servers of
  66. # all the services (for a given route) get merged altogether under the same
  67. # load-balancing strategy.
  68. services:
  69. - name: s1
  70. port: 80
  71. healthCheck:
  72. path: /health
  73. host: baz.com
  74. intervalSeconds: 7
  75. timeoutSeconds: 60
  76. # strategy defines the load balancing strategy between the servers. It defaults
  77. # to Round Robin, and for now only Round Robin is supported anyway.
  78. strategy: RoundRobin
  79. - name: s2
  80. port: 433
  81. healthCheck:
  82. path: /health
  83. host: baz.com
  84. intervalSeconds: 7
  85. timeoutSeconds: 60
  86. - match: PathPrefix(`/misc`)
  87. services:
  88. - name: s3
  89. port: 80
  90. middlewares:
  91. - name: stripprefix
  92. - name: addprefix
  93. - match: PathPrefix(`/misc`)
  94. services:
  95. - name: s3
  96. port: 8443
  97. # scheme allow to override the scheme for the service. (ex: https or h2c)
  98. scheme: https
  99. # use an empty tls object for TLS with Let's Encrypt
  100. tls:
  101. secretName: supersecret
  102. options:
  103. name: myTLSOption
  104. namespace: default
  105. ---
  106. apiVersion: traefik.containo.us/v1alpha1
  107. kind: IngressRouteTCP
  108. metadata:
  109. name: ingressroutetcp.crd
  110. namespace: default
  111. spec:
  112. entryPoints:
  113. - footcp
  114. routes:
  115. - match: HostSNI(`bar.com`)
  116. services:
  117. - name: whoamitcp
  118. port: 8080
  119. tls:
  120. secretName: foosecret
  121. passthrough: false
  122. options:
  123. name: myTLSOption
  124. namespace: default