Ki and ka are used depending on the person or object they are referring to. If the object or person is feminine, you use ki while if it's masculine, you use ka.
Example - Peter's sister - Peter ki bahan
Here we would always use "ki" because the word sister is feminine. So it doesn't matter whose sister we talk about, we will always use "ki".
Olivia's house - Olivia ka ghar
Here "ka" refers to ghar(house). Since ghar is masculine in Hindi, we will always use "ka".
Peter's house - Peter ka ghar
Sarah's house - Sarah ka ghar
You just have to remember that ki/ka is not being decided by the subject. The house(ghar) could belong to a male or female but we would always use "ka" because house(ghar) is considered masculine in Hindi.