How to use tcpkill to simulate network failure (e.g. for FMEA testing) by breaking network connections between your pod and a remote service.
I'm assuming your pod runs as non-root.
You'll need to add your user to the sudoers file, so in your Dockerfile
:
FROM ubuntu
# ...
RUN adduser --disabled-password --uid 9653 runner
RUN adduser runner sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER 9653
When you start you pod, add the NET_ADMIN
capability, otherwise you'll get permission denied errors.
Start your pod as normal, then start TCP kill:
kubectl exec -ti ${podName} -c ${containerName} -- sudo tcpkill port ${portNumber}
Network connections are not severed.