Skaffold Documentation
Skaffold is a command line tool that facilitates continuous development for Kubernetes-native applications. Skaffold handles the workflow for building, pushing, and deploying your application, and provides building blocks for creating CI/CD pipelines. This enables you to focus on iterating on your application locally while Skaffold continuously deploys to your local or remote Kubernetes cluster.
Features
- Fast local Kubernetes Development
- optimized “Source to Kubernetes” - Skaffold detects changes in your source code and handles the pipeline to build, push, test and deploy your application automatically with policy-based image tagging and highly optimized, fast local workflows
- continuous feedback - Skaffold automatically manages deployment logging and resource port-forwarding
- Skaffold projects work everywhere
- share with other developers - Skaffold is the easiest way to share your project with the world:
git clone
andskaffold run
- context aware - use Skaffold profiles, local user config, environment variables, and flags to easily incorporate differences across environments
- CI/CD building blocks - use
skaffold build
,skaffold test
andskaffold deploy
as part of your CI/CD pipeline, or simplyskaffold run
end-to-end - GitOps integration - use
skaffold render
to build your images and render templated Kubernetes manifests for use in GitOps workflows
- share with other developers - Skaffold is the easiest way to share your project with the world:
- skaffold.yaml - a single pluggable, declarative configuration for your project
- skaffold init - Skaffold can discover your build and deployment configuration and generate a Skaffold config
- multi-component apps - Skaffold supports applications with many components, making it great for microservice-based applications
- bring your own tools - Skaffold has a pluggable architecture, allowing for different implementations of the build and deploy stages
- Lightweight
- client-side only - Skaffold has no cluster-side component, so there’s no overhead or maintenance burden to your cluster
- minimal pipeline - Skaffold provides an opinionated, minimal pipeline to keep things simple
Demo
Skaffold Workflow and Architecture
Skaffold simplifies your development workflow by organizing common development
stages into one simple command. Every time you run skaffold dev
, the system
- Collects and watches your source code for changes
- Syncs files directly to pods if user marks them as syncable
- Builds artifacts from the source code
- Tests the built artifacts using container-structure-tests or custom scripts
- Tags the artifacts
- Pushes the artifacts
- Deploys the artifacts
- Monitors the deployed artifacts
- Cleans up deployed artifacts on exit (Ctrl+C)
Note
Any of these stages can be skipped.The pluggable architecture is central to Skaffold’s design, allowing you to use
your preferred tool or technology in each stage. Also, Skaffold’s profiles
feature
grants you the freedom to switch tools on the fly with a simple flag.
For example, if you are coding on a local machine, you can configure Skaffold to build artifacts
with your local Docker daemon and deploy them to minikube using kubectl
.
When you finalize your design, you can switch to your production profile and start building with
Google Cloud Build and deploy with Helm.
Skaffold supports the following tools:
- Dockerfile
- locally with Docker
- in-cluster with Kaniko
- on cloud with Google Cloud Build
- Jib Maven and Gradle
- locally
- on cloud with Google Cloud Build
- Bazel locally
- Cloud Native Buildpacks
- locally with Docker
- on cloud with Google Cloud Build
- Custom script
- locally
- in-cluster
- container-structure-test
- custom script
- Kubernetes Command-Line Interface (
kubectl
) - Helm
- kustomize
- tag by git commit
- tag by current date & time
- tag by environment variables based template
- tag by digest of the Docker image
- don’t push - keep the image on the local daemon
- push to registry
Besides the above steps, Skaffold also automatically manages the following utilities for you:
- port-forwarding of deployed resources to your local machine using
kubectl port-forward
- log aggregation from the deployed pods