k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
28.08k stars 2.35k forks source link

Document Traefik and cattle usage and what happens when disabled #1221

Closed kamilgregorczyk closed 4 years ago

kamilgregorczyk commented 4 years ago

Could you please describe what's the exact role of Traefik and Cattle in k3s and what's going to happen when it gets disabled on the server node?

I'm asking for this because I noticed that for a 4 node cluster there's a pod for each node that's responsible for (I guess) service load balancing.:

➜  ~ kubectl get services -n kubernetes-dashboard -o wide
NAME                        TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)          AGE   SELECTOR
dashboard-metrics-scraper   ClusterIP      10.43.97.2     <none>          8000/TCP         26h   k8s-app=dashboard-metrics-scraper
kubernetes-dashboard        LoadBalancer   10.43.208.83   192.168.0.210   8082:32638/TCP   25h   k8s-app=kubernetes-dashboar

It seems like a waste of resources, normally 5 deployments would result in 1 pod for each deployment (if not scaled) but in k3s it also adds additional pod per each node per each service so 5 different services * 4 nodes equals to 20 pods

➜  ~ kubectl get pods -n kubernetes-dashboard -o wide
NAME                                         READY   STATUS    RESTARTS   AGE   IP           NODE      NOMINATED NODE   READINESS GATES
svclb-kubernetes-dashboard-h2vgt             1/1     Running   1          25h   10.42.2.11   worker2   <none>           <none>
kubernetes-dashboard-5996555fd8-k684f        1/1     Running   1          26h   10.42.2.12   worker2   <none>           <none>
svclb-kubernetes-dashboard-b85qs             1/1     Running   1          25h   10.42.0.38   master    <none>           <none>
svclb-kubernetes-dashboard-j8tg5             1/1     Running   1          25h   10.42.3.12   worker3   <none>           <none>
svclb-kubernetes-dashboard-lq5tj             1/1     Running   1          25h   10.42.1.14   worker1   <none>           <none>
dashboard-metrics-scraper-76585494d8-bzccd   1/1     Running   2          26h   10.42.1.11   worker1   <none>           <none>
davidnuzik commented 4 years ago

Noting here for future reference, Nginx will become the default ingress controller in our next release. You can still use Traefik if wanted however. See https://github.com/rancher/k3s/issues/817 for details.

kamilgregorczyk commented 4 years ago

thanks