Difficulty: Beginner
Estimated Time: 10 minutes

Deploying a service onto Kubernetes

Are you a developer, and want to play around with Kubernetes?

In this tutorial, we'll show you the basics of deploying a service into Kubernetes from source code to a running Kubernetes cluster.

(This is straightforward, but more complicated than you might expect.)

Get started!

To get started with this tutorial, click on the Start Scenario button.


In this scenario, we've shown how you get source running in Kubernetes. This involves three basic concepts:

  • the container, which encapsulates your service and all its runtime dependencies, as defined in a Dockerfile
  • the container registry, which hosts your Docker images
  • the Kubernetes manifest, which specifies what/how a Docker image is run

We've also explored ways to automate the process (via Forge).

What next?

  1. Set up your own Kubernetes cluster locally (with Minikube), in the cloud (with Google Container Engine), or install it yourself on AWS.

  2. Download http://forge.sh to deploy your own source code into your Kubernetes installation, without requiring any special servers or setup. Forge also handles multi-service deployments, which get handy as your application grows in complexity.

  3. Send us an email at [email protected] if you have any questions or feedback!

Deploying a service from source onto Kubernetes

Step 1 of 6

The container

Kubernetes doesn't run your source code directly. Instead, you hand Kubernetes a container.

A container contains 1) a compiled version of your source code and 2) any/all runtime dependences necessary to run your source code.

In this tutorial, we're going to use Docker as our container format. We've created a simple web application in Python, the hello-webapp. To package the webapp as a Docker container, we create a Dockerfile.

We've created a Dockerfile for you, so just type the following commands to see its contents:

cd hello-webapp

cat Dockerfile

This Dockerfile starts with the base image (Alpine:3.5), installs the necessary Python dependencies for the webapp, exposes a port for the webapp on the container, and then specifies the command to run when the container starts.

You can build the Docker container manually with this command:

docker build -t hello-webapp:v1 .

This command reads the Dockerfile, and then builds a binary image that contains everything necessary for the webapp to run.