hi,
im quite new with traefik and still want to explore more about traefik with kubernetes,
so recently i deploy ingressroutes in kubernetes
traefik.yaml
image:
name: traefik
tag: "2.9.6"
providers:
kubernetesCRD:
enabled: true
allowCrossNamespace: true
additionalArguments:
- "--certificatesresolvers.le-staging.acme.tlschallenge=true"
- "--certificatesresolvers.le-staging.acme.email=xxx"
- "--certificatesresolvers.le-staging.acme.storage=/data/acme.json"
- "--certificatesresolvers.le-staging.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "--certificatesresolvers.le.acme.email=xxx"
- "--certificatesresolvers.le.acme.storage=/data/acme.json"
persistence:
enabled: true
name: data
accessMode: ReadWriteOnce
size: 1Gi
path: /data
logs:
access:
enabled: true
ingress-svc.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: svc-dashboard
namespace: namespace-name
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(apps.website.com
)
services:
- kind: Service
name: service-name
namespace: namespace-name
port: 80
tls:
certResolver: le
svc-name.yaml
apiVersion: v1
kind: Service
metadata:
name: service-name
namespace: namespace-name
uid: baae5845-52c2-4875-a559-686423e9066b
resourceVersion: '28557559'
creationTimestamp: '2023-01-16T15:40:19Z'
labels:
app.kubernetes.io/component: server
app.kubernetes.io/name: service-name
app.kubernetes.io/part-of: namespace-service
annotations:
cloud.google.com/neg: '{"ingress":true}'
kubectl.kubernetes.io/last-applied-configuration: >
xx
managedFields:
- manager: kubectl-client-side-apply
operation: Update
apiVersion: v1
time: '2023-01-16T15:40:19Z'
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:labels:
.: {}
f:app.kubernetes.io/component: {}
f:app.kubernetes.io/name: {}
f:app.kubernetes.io/part-of: {}
f:spec:
f:internalTrafficPolicy: {}
f:ports: {}
f:selector: {}
f:sessionAffinity: {}
- manager: node-fetch
operation: Update
apiVersion: v1
time: '2023-01-27T04:00:06Z'
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:externalTrafficPolicy: {}
f:ports:
k:{"port":80,"protocol":"TCP"}:
.: {}
f:name: {}
f:port: {}
f:protocol: {}
f:targetPort: {}
k:{"port":443,"protocol":"TCP"}:
.: {}
f:name: {}
f:port: {}
f:protocol: {}
f:targetPort: {}
f:type: {}
selfLink: /api/v1/namespaces/argocd/services/service-name
status:
loadBalancer: {}
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
- name: https
protocol: TCP
port: 443
targetPort: 8080
selector:
app.kubernetes.io/name: service-name
clusterIP: 10.64.9.9
clusterIPs:
- 10.64.9.9
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
i have some working service with current setup
app.yaml
apiVersion: v1
kind: Service
metadata:
name: weatherweb-prod
namespace: weatherweb-prod
uid: c89e9b11-7176-4971-8164-acd230a93c65
resourceVersion: '27174399'
creationTimestamp: '2023-01-25T09:19:19Z'
labels:
app.kubernetes.io/instance: weatherweb-ops-prod
annotations:
cloud.google.com/neg: '{"ingress":true}'
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"weatherweb-ops-prod"},"name":"weatherweb-prod","namespace":"weatherweb-prod"},"spec":{"ports":[{"port":5000,"protocol":"TCP","targetPort":5000}],"selector":{"app":"weatherweb-prod"}}}
managedFields:
- manager: argocd-controller
operation: Update
apiVersion: v1
time: '2023-01-25T09:19:19Z'
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:labels:
.: {}
f:app.kubernetes.io/instance: {}
f:spec:
f:internalTrafficPolicy: {}
f:ports:
.: {}
k:{"port":5000,"protocol":"TCP"}:
.: {}
f:port: {}
f:protocol: {}
f:targetPort: {}
f:selector: {}
f:sessionAffinity: {}
f:type: {}
selfLink: /api/v1/namespaces/weatherweb-prod/services/weatherweb-prod
status:
loadBalancer: {}
spec:
ports:
- protocol: TCP
port: 5000
targetPort: 5000
selector:
app: weatherweb-prod
clusterIP: 10.64.8.215
clusterIPs:
- 10.64.8.215
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
ingress-app.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"traefik.containo.us/v1alpha1","kind":"IngressRoute","metadata":{"annotations":{},"name":"weatherweb-prod","namespace":"weatherweb-prod"},"spec":{"entryPoints":["websecure"],"routes":[{"kind":"Rule","match":"Host(apps-prod.ogahkerja.site
)","services":[{"kind":"Service","name":"weatherweb-prod","namespace":"weatherweb-prod","port":5000}]}],"tls":{"certResolver":"le"}}}
creationTimestamp: '2023-01-25T09:27:54Z'
generation: 2
managedFields:
- apiVersion: traefik.containo.us/v1alpha1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:spec:
.: {}
f:entryPoints: {}
f:routes: {}
f:tls:
.: {}
f:certResolver: {}
manager: kubectl-client-side-apply
operation: Update
time: '2023-01-25T09:27:54Z'
name: weatherweb-prod
namespace: weatherweb-prod
resourceVersion: '27179656'
uid: b7d32829-9361-4616-b045-07ec785ed602
selfLink: >-
/apis/traefik.containo.us/v1alpha1/namespaces/weatherweb-prod/ingressroutes/weatherweb-prod
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(apps-prod.ogahkerja.site
)
services:
- kind: Service
name: weatherweb-prod
namespace: weatherweb-prod
port: 5000
tls:
certResolver: le
i already tried change the port from svc-name.yaml
ports:
name: http
protocol: TCP
port: 80
targetPort: 8080
ports:
name: http
protocol: TCP
port: 8080
and doesnt working either.
what i missing with this setup ?