New Project

If you already a project with an existing Dockerfile, you can use that. If you do not, kubes generates a starter Dockerfile that runs nginx. For this tutorial, we’ll start with an empty folder.

mkdir demo
cd demo

For this tutorial, here are examples of AWS ECR and Google GCR repos, though any repo will work.


REPO=$(aws ecr describe-repositories --repository-name demo | jq -r '.repositories[].repositoryUri')


export GOOGLE_PROJECT=project-123$GOOGLE_PROJECT/demo

Let’s initialize a starter kubes project. This is similar to a git init.

$ kubes init --app demo --repo $REPO
      create  Dockerfile
      create  .kubes/config.rb
      create  .kubes/config/env/dev.rb
      create  .kubes/config/env/prod.rb
      create  .kubes/resources/base/all.yaml
      create  .kubes/resources/base/deployment.yaml
      create  .kubes/resources/shared/namespace.yaml
      create  .kubes/resources/web/deployment.yaml
      create  .kubes/resources/web/deployment/dev.yaml
      create  .kubes/resources/web/deployment/prod.yaml
      create  .kubes/resources/web/service.yaml
Initialized .kubes folder
Updated .gitignore

To learn more about the generated structure, here are the Structure Docs.

Let’s explore some of the generated files.


The config.rb is where you can configure Kubes settings.


Kubes.configure do |config|
  config.repo = "" # may be
  config.logger.level = "info"
  # auto-switching
  # config.kubectl.context = "dev-cluster"

This is where the --repo from kubes init got saved. The other options are covered in the Env Config Docs.


The Dockerfile is a simple starter example that just runs nginx


# Simple example starter
FROM nginx
CMD ["nginx", "-g", "daemon off;"]

Note: If your project already has a Dockerfile, kubes will use that instead of generating a starter one.

Next, we’ll review the resources.