Character deaths can be shocking, but they can also exist for shock value. The difference between them being that you don’t see a shocking death coming, but it is still justified and helps to progress the plot. Deaths that occur for shock value might seem shocking, but they don’t provide any of the other necessities.
Examples of shocking (but good) deaths:
(I tried not to make it spoilery for people who haven’t read the books/seen the movies/seen the TV show.)
Some examples of what character deaths can do:
Killing off characters can be used effectively to show the stakes of your novel, especially if done well. This is kind of relevant, but a long time ago, I watched an interview with JK Rowling and there was a question about how she chooses which characters die in her books.
I can’t remember her exact answer, and I can’t find the interview to link to, but she said something along the lines of, “The bad guys aren’t going to go only after side characters. They’re going to try to kill the ones who pose the biggest threat—the main characters.” I really like her answer.
But to wrap this up, I think if you put time and thought into your character death and it isn’t just something like, “Holy shit! The evil overlord killed a child whom we’ve never seen before and put their head on a pike outside his castle at a clear attempt to shock and disgust us!” you’re fine.