alexei-led / pumba

Chaos testing, network emulation, and stress testing tool for containers
Apache License 2.0
2.78k stars 195 forks source link

Unable to pull the tc image #173

Closed avinashnarra closed 1 year ago

avinashnarra commented 4 years ago

@alexei-led I am trying to run pumba in kubernetes and adding tc-image, but logs says "unable to pull the tc-image".So could you please help me.Tried various ways . So i am doing it in kubernetes way and it creates daemon set with pumba docker image and trying to pull iproute2 image and it is not able to pull the image due to some restrictions inside our environment. So is there any other way that i can pull the images? Is it possible for you to add the docker image inside pumba image so that it would be very helpful to me

alexei-led commented 4 years ago

@avinashnarra can you pull gaiadocker/iproute2 on your K8s nodes? In general, you can create and use any Docker image that has tc tool on-board. For example, create your own Alpine based image and add iproute2 package to it.

avinashnarra commented 4 years ago

@alexei-led i created my own iproute2 image but seeing below error.

DEBU[0001] tc container created, starting it id=b572c49c994b34ef612c0eb21b5186317d2dd1cf2249073a536a17a0a45552ca WARN[0001] failed to delay network for container error="failed to start tc-container: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused \"exec: \\"tc\\": executable file not found in $PATH\": unknown" FATA[0001] failed to delay packets for one or more containers: failed to start tc-container: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"tc\": executable file not found in $PATH": unknown

can u please help me

alexei-led commented 4 years ago

@avinashnarra Please paste Dockerfile you've used to create image.

torblerone commented 4 years ago

@alexei-led I fear that the same problems await us in our company.

Is it possible to take the gaiaadm/pumba as a base image and install the iproute2 package directly on it, or does Pumba expect a container? In that case, can you give an example of a Dockerfile that you can use to build your own iproute2 package that Pumba can work with?

alexei-led commented 4 years ago

@torblerone it's possible to provide your own Docker image with tc tool on-board or add tc to the target Docker container. Both options should work. Take a look at tc.Dockerfile link

torblerone commented 4 years ago

@alexei-led So I could also use the Pumba Dockerfile and just add the lines below or simply pull the existing Docker Image and add the tc package?

RUN apk --no-cache add iproute2

RUN ln -s /usr/lib/tc /lib/tc

Or would Pumba cause problems when the tc application is installed right into its own container?

alexei-led commented 4 years ago

Pumba uses "docker exec/run" API to run "tc" command in the target's container network namespace.

Probably it is possible to run "tc" command available in $PATH and attach it to the target namespace, and this will allow you to package a "tc" tool in the same Docker image as Pumba.

But, today, you need either add "tc" tool to the target container or bring a new Docker image with "tc" tool on-board.