$nid = 1;
$entity_type = 'node';
$view_mode = 'teaser';
$view_builder = Drupal::entityTypeManager()->getViewBuilder($entity_type);
$storage = Drupal::entityTypeManager()->getStorage($entity_type);
$node = $storage->load($nid);
$build = $view_builder->view($node, $view_mode);