apache / trafficcontrol

Apache Traffic Control is an Open Source implementation of a Content Delivery Network
https://trafficcontrol.apache.org/
Apache License 2.0
1.02k stars 339 forks source link

Improvement: Port conflict of traffic_ops container with Kubernetes #7404

Open jammutkarsh opened 1 year ago

jammutkarsh commented 1 year ago

This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:

Current behavior:

If Kubernetes is enabled on the system and a development environment is started from dev/ using atc start. There is a port conflict between traffic_ops container and Docker backend API.

Terminal output:

$ atc start                                                                                                       

[+] Building 4.2s (45/45) FINISHED
# ----Rest of the build and start process by docker----
 ⠿ Container trafficcontrol-db-1          Running                                                                       0.0s
 ⠏ Container trafficcontrol-trafficops-1  Starting                                                                     15.9s
Error response from daemon: driver failed programming external connectivity on endpoint trafficcontrol-trafficops-1 (b09986bf574a9ce0b85b3710d1df3274bb023cdc4300aafecde215a6bc261eca): listen tcp4 0.0.0.0:6443: bind: address already in use

$ lsof -i :6443
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
com.docke 8172  utc  168u  IPv4 0x264940a1a6d323cd      0t0  TCP localhost:sun-sr-https (LISTEN)

$ ps 8172
  PID   TT  STAT      TIME COMMAND
 8172   ??  S      7:07.94 /Applications/Docker.app/Contents/MacOS/com.docker.backend -watchdog -native-api

$

ref: Docker Blog

New behavior:

Change the port of Traffic_ops container.

Steps to reproduce:

  1. Start Kubernetes from Docker preferences/settings
  2. cd dev/
  3. source $(pwd)/atc.dev.sh
  4. atc start
ocket8888 commented 1 year ago

The container for the trafficops service uses the same port as the CDN-in-a-Box default configuration for its own Traffic Ops container. So it should only change if both change.

But also, the development environment doesn't use kubernetes, so could you not simply turn it off? We can't reasonably avoid conflicts with any arbitrary unrelated program a user may be running at the same as the dev environment.

jammutkarsh commented 1 year ago

But also, the development environment doesn't use kubernetes, so could you not simply turn it off? We can't reasonably avoid conflicts with any arbitrary unrelated program a user may be running at the same as the dev environment.

We could definitely turn K8 off, but it would make for a less than ideal development experience since they would again turn it on when switching to another project that uses K8.

Yet again, altering the configuration of one component should not have any potential impact on other system components. We might close this issue if it is not relevant.

ocket8888 commented 1 year ago

Well , perhaps it ought to be configurable. I just don't want to fall down a rabbit hole and wind up creating a generalized CDN initialization system (again). It's supposed to be as simple as possible.