traefik / whoami

Tiny Go server that prints os information and HTTP request to output
https://traefik.io
Apache License 2.0
1.04k stars 222 forks source link

whoami pods unable to start #47

Closed bgounon closed 2 years ago

bgounon commented 2 years ago

Hello, We're running whoami for testing purposes on our K8S Cluster, using latest DockerHub image. We're seeing a new issue today that we didn't have before. Pods fail to start with the following logs:

Starting up on port tcp://10.100.7.29:80
2021/12/03 16:44:43 listen tcp: address :tcp://10.100.7.29:80: too many colons in address

I see there has been a new release today, is it related ? I can reproduce at will by simply pushing the following configuration to a K8S cluster:

kind: Deployment
apiVersion: apps/v1
metadata:
  name: whoami
  labels:
    app: traefiklabs
    name: whoami
spec:
  replicas: 2
  selector:
    matchLabels:
      app: traefiklabs
      task: whoami
  template:
    metadata:
      labels:
        app: traefiklabs
        task: whoami
    spec:
      containers:
        - name: whoami
          image: traefik/whoami
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: whoami
  annotations:
    traefik.ingress.kubernetes.io/service.sticky: "true"
    traefik.ingress.kubernetes.io/service.sticky.cookie: "true"
    traefik.ingress.kubernetes.io/service.sticky.cookie.name: "StickyCookie"
    traefik.ingress.kubernetes.io/service.sticky.cookie.secure: "false"
spec:
  ports:
    - name: http
      port: 80
  selector:
    app: traefiklabs
    task: whoami

---
kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: whoami
  annotations:
    kubernetes.io/tls-acme: "true"
spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /
            backend:
              serviceName: whoami
              servicePort: 80

Edit: using image traefik/whoami:v1.6.1 fixes the issue

ldez commented 2 years ago

Hello,

The problem is related to the fact the port flag is filled by an address instead of a port.

# version v1.5.0
$ whoami -port tcp://10.100.7.29:80
Starting up on port tcp://10.100.7.29:80
2021/12/03 18:32:25 listen tcp: address :tcp://10.100.7.29:80: too many colons in address
exit status 1

# version v1.6.0
$ whoami -port tcp://10.100.7.29:80
Starting up on port tcp://10.100.7.29:80
2021/12/03 18:31:42 listen tcp: address :tcp://10.100.7.29:80: too many colons in address
exit status 1

# version v1.7.0
$ whoami -port tcp://10.100.7.29:80
Starting up on port tcp://10.100.7.29:80
2021/12/03 18:34:04 listen tcp: address :tcp://10.100.7.29:80: too many colons in address
exit status 1

Maybe you have an env var called WHOAMI_PORT with the value tcp://10.100.7.29:80

ldez commented 2 years ago

It seems related to a k8s behavior.

ldez commented 2 years ago

fixed by a067f0ee4c524f380f65ff4b5cb04aff9298d6dd

I will created a bug-fix release.