In order to publish your app on Kubernetes using Cuber, simply open your app folder and create a Cuberfile with this code:

# Give a name to your app
app 'myapp'

# Get the code from this Git repository
repo '.'

# Build the Docker image automatically (or provide a Dockerfile)
buildpacks 'heroku/buildpacks:20'

# Publish the Docker image in a registry
image 'username/myapp'

# Connect to this Kubernetes cluster
kubeconfig 'path/to/kubeconfig.yml'

# Run and scale any command on Kubernetes
proc :web, 'your web server command'

Then type cuber deploy in your terminal to publish your app.

The command will execute the following steps:

  1. Checkout the code from the Git repository
  2. Build the app using Buildpacks or Docker
  3. Publish the Docker image in the Docker registry
  4. Run your app on Kubernetes

Finally you can see the status and configuration of your remote app with cuber info. This command also shows the public IP: copy it in your browser address bar to open your website.

Cuberfile template (a more complete example)

In the Quickstart guide we used a Cuberfile with minimal configuration, but there are many more options and features available. Here’s a more complete Cuberfile example that you can use as a basic template for your app:

# The name of your app (it is used as a namespace on Kubernetes)
app 'my-app'

# The name of an existing release (not necessary for normal deployments)
# It's only for rollbacks to a previous version or to lock to a specific version
# release 'abcdefg-20211201170000'

# The Git repository URL (or local path)
# This repository will be cloned on your machine in order build your app
repo '.'

# Build a Docker image of your app automatically using Cloud Native Buildpacks
buildpacks 'heroku/buildpacks:20'

# Alternatively, if you need more customization, you can provide a Dockerfile
# dockerfile 'Dockerfile'

# The Docker repository where the image will be stored
# Include only the image name, without any tag
image 'username/my-app'

# You can disable the cache to refresh the base image and all the cache layers
# cache false

# The Docker config, which must contain the credentials (auth) to access the registry
# The default is ~/.docker/config.json, otherwise you can set it here
# dockerconfig 'dockerconfig.json'

# The kubeconfig file contains the credentials to access to the Kubernetes cluster
kubeconfig 'kubeconfig.yml'

# Optionally you can run a migration command (e.g. database) during each release
# migrate 'migrate command'

# Run and scale any process (web server, background workers, etc.) on Kubernetes
proc :web, 'web command', scale: 5
proc :worker, 'worker command', scale: 10

# Add cron jobs (they spin up a new pod with your app image)
cron :example, '* * * * *', 'example command'

# Set some environment variables
env 'EXAMPLE_ENV_VAR', 'example value'

# Set some secrets that will be available as environment variables
env 'EXAMPLE_SECRET','path/to/secret.key').strip, secret: true

# Depending on your provider, you can configure specific settings of the load balancer
# lb '', 'my-app-static-ip'

# Depending on your provider, you may want to use an Ingress instead of a Load Balancer
# You should use this on GKE for example
# ingress true

# You can provide a custom SSL/TLS certificate for HTTPS if you want
# ssl 'ssl/cert.pem', 'ssl/key.pem'