How do I export an entity?
You want the Default Content for D8 module, which provides drush commands to export and installs the content on module install. From its project page:

Default content gives your module and install profile a way to ship default content as well as configuration. Powered by core's serialization, rest and hal modules.
Features

Supports entity-references between content.
Supports files if you have File entity
Easily export your content and its dependencies to yml using drush commands.