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.)
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
- 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).
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.
Send us an email at [email protected] if you have any questions or feedback!
Deploying a service from source onto Kubernetes
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
We've created a
Dockerfile for you, so just type the following commands to see its contents:
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.