Deploy a Rust Web Service
From cargo build to a live HTTPS API — no ops required.
Overview
Rust web services compile to fast, memory-safe binaries that start in milliseconds. Combined with Kubeletto's scale-to-zero container runtime, Rust is one of the most cost-effective backend choices available — zero CPU cost when idle, near-instant cold starts when traffic arrives.
Prerequisites
- A Rust project with a binary target that starts an HTTP server
- Cargo.toml with workspace configured
- A Kubeletto account
Step-by-Step Guide
Deploying Axum / Actix-Web / Warp to Kubeletto is done by configuring a Dockerfile, connecting your GitHub repository, and setting environment variables. Follow this step-by-step checklist to deploy your code:
- 1
Multi-stage Dockerfile for Rust
Use cargo-chef for dependency caching and a minimal runtime image.
dockerfileFROM rust:1.77-slim AS builder WORKDIR /app COPY Cargo.toml Cargo.lock ./ COPY src ./src RUN cargo build --release FROM debian:bookworm-slim RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/my-api /usr/local/bin/my-api EXPOSE 3000 CMD ["my-api"] - 2
Read PORT from environment
Bind your Axum or Actix server to the PORT env var Kubeletto provides.
rustlet port = std::env::var("PORT").unwrap_or_else(|_| "3000".to_string()); let addr = format!("0.0.0.0:{}", port).parse()?; axum::Server::bind(&addr).serve(app.into_make_service()).await?; - 3
Deploy to Kubeletto
Push to GitHub or deploy directly.
bashkubeletto deploy --source github --repo your-org/rust-api --branch main
Sample Environment Variables
To configure your Axum / Actix-Web / Warp application, set these key-value pairs in the environment variables tab of the Kubeletto console or CLI. Ensure production secrets are flagged as write-only:
PORT=3000
DATABASE_URL=postgres://user:pass@host:5432/dbname
RUST_LOG=info
JWT_SECRET=your-secret Related Kubeletto Features
Kubeletto offers automatic SSL certificate provisioning, zero-downtime rollbacks, and scale-to-zero autoscaling for Axum / Actix-Web / Warp container workloads:
PaaS Platform Comparisons
See how Kubeletto compares directly against other cloud platforms and PaaS providers when deploying Rust workloads:
Frequently Asked Questions
Find direct answers to common questions about hosting, building, scaling, and managing Axum / Actix-Web / Warp containerized apps on Kubeletto:
Rust builds take a long time — will that be a problem?
Kubeletto uses BuildKit with layer caching. After the first build, dependency layers are cached and only changed code is recompiled. Subsequent deploys are much faster.
Can I use cargo-chef for better caching?
Yes. Using cargo-chef in your multi-stage Dockerfile is highly recommended to cache dependency compilation separately from your source code.
Does Kubeletto support gRPC with Rust (tonic)?
Yes. tonic gRPC services run as standard HTTP/2 services inside containers. Expose the gRPC port and it works the same as any other container.
More Deploy Guides
Deploy your Axum / Actix-Web / Warp app today
Free during our active beta. No credit card required.
Start Deploying Free