traefik / traefik

The Cloud Native Application Proxy
https://traefik.io
MIT License
50.59k stars 5.05k forks source link

Kubernetes Example Address already in use #872

Closed dweidenfeld closed 7 years ago

dweidenfeld commented 7 years ago

Hey there,

I have a plain fresh Kuberentes setup running. Now I wanted to add Treafik, but it gives me an error, that the address 8080 is already in use:

kubectl apply -f traefik.yaml

The config is the default config from the examples folder.

Error syncing pod, skipping: failed to "StartContainer" for "traefik-ingress-lb" with CrashLoopBackOff: "Back-off 10s restarting failed container=traefik-ingress-lb pod=traefik-ingress-controller-2249976834-5a8l0_kube-system(d61d4637-b0af-11e6-9d04-0050563cd6c3)"

or the logs

time="2016-11-22T12:35:00Z" level=fatal msg="Error creating server: listen tcp :8080: bind: address already in use"

of course the port 8080 is already in use, because the api server uses it

tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      0          1750820     21231/kube-apiserve...

Any ideas? Thank you :)

jonaz commented 7 years ago

Dont use 8080 for the web ui. Change to 8081 for example

apiVersion: v1
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: traefik-ingress-controller
  namespace: kube-system
  labels:
    k8s-app: traefik-ingress-lb
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: traefik-ingress-lb
  template:
    metadata:
      labels:
        k8s-app: traefik-ingress-lb
        name: traefik-ingress-lb
    spec:
      terminationGracePeriodSeconds: 60
      hostNetwork: true
      containers:
      - image: traefik
        name: traefik-ingress-lb
        resources:
          limits:
            cpu: 200m
            memory: 30Mi
          requests:
            cpu: 100m
            memory: 20Mi
        ports:
        - name: http
          containerPort: 80
          hostPort: 80
        - name: admin
          containerPort: 8081
        args:
        - --web
        - --web.address=:8081
        - --kubernetes
dweidenfeld commented 7 years ago

Thank you that works