Normally no, but there are a few exceptions
- If it's all you can do to protect yourself or others
- Strictly speaking euthanasia is also a kill, however when done according to what euthanasia really is, it can actually be an act of pure goodness.
- Of course, it's also possible you kill somebody when you didn't mean to, and that there was actually nothing you could do from preventing it from happening. An accident, so to speak. Strictly speaking also a kill, and one you can't help and you can normally not even be sued for but still a kill. I really hope that will never happen to me.
Now when it comes to killing I don't want to speak of "good" or "bad". Many murder cases are by far more complex than that. Also it's scientifically proven that every human being can be driven to so much anger they will eventually kill you for that. Is for one person saying "your mother is a w**re" enough to get them to that point for the other you really have to put up a well thought out plan to get them so far beyond anger they lose control, and in the latter situation in particular you must be careful to judge. For the people in the latter group it's no longer an okay or not okay, they've just been driven to the point where they are no longer able to act on rational and ethical thinking. Makes the kill maybe still not okay, but blindly blaming the killer in that kind of situation can be an error too. Some victims really "had it coming" to say it rather bluntly. Only when you've experienced the madness I'm describing here yourself you can judge about this, and if you criticize me on that one, you clearly never experienced it, and should therefore keep your mouth shut, trust me on that one. I've seen situations like those with my own two eyes... fortunately never came so far an actual kill was performed, but I am not sure how much more would have been required for that.
In a basic rule, nothing gives somebody the right to take the life of somebody else. However in some situations, it's not the right, or something being okay that counts.
And then I didn't even mention situation in which you may stand before the choice that you have to kill somebody to save the lives of millions of others, even though that person themselves is not the immediate threat, but still you know that if you don't do it millions of others may (or will) die. The "needed sacrifice" so to speak. If you'd ever face that decision would you be able to do it?
The question "is it ok" isn't really right.