Coding cron job in Drupal 8

Coding a cron job in drupal 8 is pretty easy. All you have to do is go to your module folder, open .module file and add hook_cron function, so lets add some content with our hook_cron

function modulename_cron() {
    $node = entity_create('node', array(
      'title' => 'New Article',
      'body' => 'Article body',
      'type' => 'article',
    ));
    $node->save();
}

so we are assuming you have "article" node type, we are creating a new node with this cron job. So after you add this, go ahead, run cron job with drush or through UI, you will have a new node.