[HELP] - expose / access to my service with traefik dosen't work

helm : v3.16.3
kubernetes:
	Client Version: v1.31.3
	Kustomize Version: v5.4.2
	Server Version: v1.31.2
Argo CD: v2.13.1+af54ef8
Traefik version 3.2.2

Hello,

I can't access the services without using port-forwarding.

Information:
I’m setting up a home server to practice using these tools.
I use Terraform to set up my Kubernetes cluster and ArgoCD, then ArgoCD to deploy my applications.

I connect to the server (Ubuntu Server without GUI) via SSH from my personal computer.

My goal is to expose my services to manage them externally (or at least within my local network).

Using port-forwarding, I can access the ArgoCD dashboard:

kubectl port-forward service/argocd-server 30443:80 --address 0.0.0.0

Then, from my personal computer (local network), by going to http://homeserver:30443, I can successfully access the ArgoCD dashboard.

Without port-forwarding, I cannot access the URL. After some research, I understood that I needed an ingress controller. So, I deployed Traefik (via ArgoCD, Helm release).
I set the Traefik service to NodePort (I’m not using cloud providers to assign an IP address and use a LoadBalancer).

Next, I tried installing the Whoami test application, but I couldn’t connect to it via my local network (http://homeserver/whoami) or even directly from the server by running:

curl 192.168.1.43/whoami

The result is:

curl: (7) Failed to connect to homeserver port 80 after 1 ms: Couldn't connect to server

However, by using port-forwarding, I can access the Whoami application.

http://homeserver:30443/whoami

Here are the two lines concerning the Whoami application from the Traefik pod logs:

2024-12-25T10:20:32Z DBG github.com/traefik/traefik/v3/pkg/server/service/service.go:318 > Creating load-balancer entryPointName=web routerName=argocd-whoami-d1d09c71f488fb76bf87@kubernetescrd serviceName=argocd-whoami-d1d09c71f488fb76bf87@kubernetescrd
2024-12-25T10:20:32Z DBG github.com/traefik/traefik/v3/pkg/server/service/service.go:355 > Creating server entryPointName=web routerName=argocd-whoami-d1d09c71f488fb76bf87@kubernetescrd serverName=5153565a47631714 serviceName=argocd-whoami-d1d09c71f488fb76bf87@kubernetescrd target=http://10.244.1.144:80

If you need more information, feel free to ask me.

Below are the manifests for the Whoami application. I’ve been trying to figure out what’s wrong for hours and why the service is not exposed.
I greatly appreciate any help you can provide.

In ArgoCD, everything is fine for the Traefik application. No errors in the pod logs.

NAME                                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/argocd-applicationset-controller   ClusterIP   10.96.217.85    <none>        7000/TCP                     14d
service/argocd-dex-server                  ClusterIP   10.96.89.71     <none>        5556/TCP,5557/TCP            14d
service/argocd-redis                       ClusterIP   10.96.24.67     <none>        6379/TCP                     14d
service/argocd-repo-server                 ClusterIP   10.96.42.122    <none>        8081/TCP                     14d
service/argocd-server                      ClusterIP   10.96.13.49     <none>        80/TCP,443/TCP               14d
service/traefik                            NodePort    10.96.202.123   <none>        80:32041/TCP,443:32462/TCP   6d2h
service/whoami                             ClusterIP   10.96.116.137   <none>        80/TCP                       5d1h

whoami-deployment.yaml

kind: Deployment
apiVersion: apps/v1
metadata:
  name: whoami
  labels:
    app: whoami
spec:
  replicas: 1
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
        - name: whoami
          image: traefik/whoami
          ports:
            - name: web
              containerPort: 80

whoami-ingressroute.yaml

apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: whoami
  namespace: argocd
spec:
  entryPoints:
    - web
  routes:
    - kind: Rule
      match: Host(`homeserver`) && PathPrefix(`/whoami`)
      services:
      - kind: Service
        name: whoami
        port: 80
		
		apiVersion: v1

whoami-service.yaml

kind: Service
metadata:
  name: whoami
spec:
  ports:
    - name: web
      port: 80
      targetPort: web
  selector:
    app: whoami

currently I would think of an iptable problem, I don't have a kube rule, yet I don't have an error in the kube-proxy pod log, in the iptable rules I only have a docker rule.

my problem was i need nginx reverse proxy, i think is good now

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.