Warning: Spoilers for Harry Potter non-deaths.
It is common knowledge that- minus the immortal exception-with life comes death. As writers, we are creators. We build worlds, dream of universes, and perhaps most endearingly think up characters. It can be a very intimate process for some. I know it is for myself, so when our characters reach the end of their lives during our stories it can be quite difficult to 1) let them go and 2) do so sometimes less than peacefully.
Now, with each character it is different, of course. Some are predestined for their deaths to move stories and plots, created to do just that. I've killed many a character without so much as taking a moment to pause in my typing. Is this cruel? Maybe, but the story demands what the story demands.
However, there are the rare few who we get so attached to that it is difficult to fate them to anything more harsh than seasonal allergies or the occasional scraped knee. The story must go on though and not be hindered by personal qualms.
Some advice would be to not be afraid to off a few characters here and there! It's natural. It'll happen eventually...unless your protagonist is some sort of perennial jellyfish. In that case, there are many guidelines you can throw out the submarine window.
Some advice from the other end of the spectrum would be to kill only when absolutely necessary to the story. Uncalled for or random deaths will get you a parade full of pitchforks and torches at your back door. Even the most esteemed writers are tempted by the therapy or brutally murdering helpless characters to relieve one's self from everyday troubles. JK Rowling herself admitted to almost killing Ron Weasley during a time she was having difficulties in her own life. Thankfully for Ron and fans of his, she decided otherwise and he pulled through. (Congrats Ronald!) Crisis averted.
Anyway, final words of wisdom: Kill and do not kill. The balance of the universe rests in your pens. Treat it with care, fellows, and good luck.