After reading comments under the question....
Photoshop has basic path editing capabilities. That is not to say they are lacking for the most part, but there are some areas which Photoshop is not as robust as Illustrator. Remember vector items are an addition to Photoshop, not it's core goal.
For Photoshop, you need to use the Pen Tool to draw a vector layer. This means you need to use Photoshop CS6 or newer. You can then add a stroke to that vector layer and move the stroke to the inside of the vector shape. This will force the stroke to have the corners you draw as opposed to rounding everything.
In many cases the strokes can cause extreme corner miters like this:
There's not a lot you can do about those other than to edit the path and ensure the corners aren't that tight of an angle. This is where Photoshop can fail with paths at times. You'll notice in the image above there are a couple sharp corners that are a bit too extended. There's no way to solve that other than to alter the angles at the corner by reducing/enlarging the amount of curve on the associated paths.
You do not want to use a brush and then use
Edit > Stroke.... This will never get sharp corners. You could use a layer style with a stroke, provided the stroke is also aligned to the inside of the shape.
For Illustrator, It's a simple matter of drawing your shape.
Illustrator provides specific adjustment to miter limits. This allows you to somewhat control how and when points become sharp:
You can also align the stroke to the inside using Illustrator (for closed paths). This generally results in a better stroke than Photoshop provides.
This was originally a 2014 answer. However....
as of February 2020...
....nothing has changed with respect to Photoshop and this answer.