:help command-line-window is one of the lesser-known features of Vim. You can enter it with
<C-f> by default when you're already on the commandline, or
q: from normal mode. As in any other Vim buffer, you can edit the current or previous command-lines using Vim commands, and press
<Enter> to execute and close it. In it, you can use
D just like anywhere else.
If you want that functionality directly in the command-line itself, you can define this simple mapping:
cnoremap <C-k> <C-\>e(strpart(getcmdline(), 0, getcmdpos() - 1))<CR>
Note that your suggested left-hand side clobbers the useful digraphs entry.
My CmdlineSpecialEdits plugin has (among many others) a
CTRL-G D mapping that removes all characters between the cursor position and the end of the line.