If the closet is big enough and you could route hot and cold water supply lines to the washer, and electric to your dryer, you could set up a laundry room in the closet. A bigger problem might be the drain line from the washer. that line must be properly vented and of sufficient diameter to carry the waste from all the fixture units (FUs) connected to it. In the IRC a washing machine counts as 2 FUs. In the UPC it counts as 3FUs. Both require a minimum trap size of 2″. A kitchen sink counts as 2 FUs in both the IRC and UPC, requiring a minimum of 1 1/2″ trap size. Most likely your existing kitchen sink DVW pipe is undersized for the addition of the new washer. If your drain is 2″ you might be able to succeed. If you’ll be tapping into a 3″-4″ drain, you’ll definitely be OK.
And don’t forget to vent the dryer properly to the outside and be sure that the closet allows for proper ventilation with fresh air (such as a window or louvered vent).
Finally, if you are renting an apartment (rather than the owner of an apartment in a building), why would you want to spend the money that your installation would require?? If you rent, make sure you have the owner’s approval for any work you do. I’d be surprised if a landlord would allow any unlicensed major plumbing work to be done on his property…
NtP