Bring coconut milk to a simmer in a medium pot over medium-high heat. Whisk together egg yolks, sugar, and vanilla in a bowl until smooth and pale.
Gradually whisk half the hot coconut milk into the egg mixture, then pour into pot with remaining coconut milk. Cook over medium heat, stirring, until thick and mixture nearly coats the back of a wooden spoon, 2 to 3 minutes.
Pour through a fine sieve into a bowl. Stir in rum, and refrigerate at least 3 hours and up to overnight. Pour into a pitcher, and serve over ice, garnished with coconut flakes.