I found myself needing to run an adhoc pod in Kubernetes on a specific node with a taint. Here's how.

I was running in to some networking problems in Kubernetes with a specific node and wanted to run a pod that had all of the networking tools installed. Primarily because I could not get to the network to install them on a base image. Basically, I was looking for a swiss army knife for Kubernetes networking that ran on Arm64.

I found this little gem on docker hub, svil/swiss-army-knife. Thanks svil.

Docker Hub

Based on the manifest from Docker Hub it had everything a DevOps engineer could possibly want. Now, I needed to run it on my problematic node. That node has a taint and a label I can use to schedule it with.

I used kubectl run to start my pod. That was easy. Scheduling it was hard.

To schedule on a specific node, you use the --overrides argument and pass in the nodeSelector. In my case, I also needed the tolerations. It requires a json format.

The end result of the command I used was:

kubectl run swissarmy4 --image=svil/swiss-army-knife -it --rm --overrides='
   "nodeSelector": { "openhab": "yes" },
   "tolerations": [
      "key": "dedicated",
      "operator": "Exists",
      "effect": "NoSchedule"
}' -- /bin/bash


I am putting this on my blog so I have it for future reference, hopefully it will help someone else out as well.