Question: how to make a command block kill the nearest player?
Answer: Command blocks cannot be moved by a piston. Then enter your desired kill command into the command block, e.g. You then activate the command block in a normal way, the easiest of which is either directly from a switch/lever, or a redstone current.