Maybe you can relate: We've finished coding a website, and we're ready to deploy. We know we want to deploy to Kubernetes, to take advantage of it's industrial-scale hosting, automatic load-balancing, fault tolerance, scaling, and more.
But deploying to Kubernetes is hard. Now we have to trek into the land of containers, pods, services, ingress, and yaml. Ugh. "I just finished the website. I don't want to read a book just to make it work." Kubernetes has too many options and concepts: Pods, Deployments, ReplicaSets, Services, ConfigMaps. Oh my! And the Kubernetes yaml file is really confusing and specific. I really wish it was easier to deploy a website to Kubernetes.
Jetpack.io is a zero-DevOps solution for deploying to Kubernetes. Jetpack.io takes your code, packages it up in a container, and publishes it to Kubernetes. Jetpack.io also creates a public URL so the site can be routable from the internet, and can stream application logs back to your terminal. All of the toil of Kubernetes melts away, and we can focus on our application.
This guide will teach you how to setup up the Jetpack backend development platform for the very first time, and how to build and deploy your first backend to a Kubernetes cluster in a matter of minutes.
You don't even need an existing Kubernetes cluster to get started – we'll give you access to a free cluster to get you up and running!
The Jetpack Command Line Interface (CLI) is a command-line tool that helps you create, build and deploy new backends directly from your terminal. It’s simple to install and works for both macOS and Linux.
To install it, run the install script:
curl https://get.jetpack.io -fsSL | bash
Validate the installation by running the jetpack version command
Next, you'll sign-up for a new Jetpack Cloud account, which will grant you access to a free Kubernetes cluster and a container registry managed by us.
- Run the following command to authenticate the CLI:
jetpack auth login
- Create a new account by following the instructions in your browser, or if you already have an account, use your existing credentials to log in.
Your CLI is now linked to your account and it's ready to deploy new backends.
Jetpack can deploy any containerized application to Kubernetes as an autoscaling, Kubernetes deployment. For this quickstart, we'll use a simple example FastAPI app from Jetpack's example repo.
git clone https://github.com/jetpack-io/jetpack-examples.git cd jetpack-examples/01-py-fastapi-quickstart
This launch a generator which will ask you a few questions to configure your project. For this quickstart, we'll choose the following options:
- What is the name of this application? 01-py-fastapi-quickstart
- Choose your project template Web Service (Since we're creating a web app with an API)
- Would you like to use Jetpack's trial cluster, or your own Kubernetes cluster? jetpack-cloud (We'll use Jetpack's trial cluster)
Here's the output you'll see:
? What is the name of this application? test-app ? What type of application is this? Web Service ? Would you like to use Jetpack's trial cluster, or your own kubernetes cluster? jetpack-cloud
This will create a
jetconifg.yaml in your project folder. This file has the basic configuration that Jetpack will use to deploy your project to Kubernetes. You should commit this file to source control.
- Deploy the Test App with Jetpack Dev We are now ready to deploy our example app! We'll deploy using jetpack dev , which will stream our service's logs to our terminal and let us quickly redeploy any changes that we make.
From within the quickstart-project folder, run:
This will create and build a Docker container for your project, push it to the container registry, and deploy it to the Kubernetes cluster. Once it finishes deploying, the CLI will stream your logs and port-forward from your local machine to the running container, so that you can test it live in the cluster:
[Done] App deployed Attempting to port forward app... The service will be accessible at http://localhost:8080 - this port forwards to port 8080 on the pod Attempting to port forward runtime... The service will be accessible at http://localhost:8090 - this port forwards to port 8080 on the pod + jetpack-runtime-7c46d5cd7b-d2ksj › jetpack-runtime + new-project-app-68b9f8cddf-xgpzg › app new-project-app-68b9f8cddf-xgpzg app INFO: Started server process  new-project-app-68b9f8cddf-xgpzg app INFO: Waiting for application startup. new-project-app-68b9f8cddf-xgpzg app INFO: Application startup complete. new-project-app-68b9f8cddf-xgpzg app INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
- Test your Service
When Jetpack finishes deploying, you can test the service at
httpie, or your browser:
You should see the response:
<h1>Hello! Welcome to Jetpack</h1>
It's easy to deploy a Python app to Kubernetes with Jetpack.io. In this tutorial we scaffolded a website, configured it for Jetpack.io, and used Jetpack.io to deploy to Kubernetes. Jetpack.io is a great zero-DevOps solution for deploying to Kubernetes. Visit https://jetpack.io/docs/ to learn more and to start deploying your content to Kubernetes with ease.