skaffold
Build, push, and deploy Kubernetes applications
TLDR
Build the artifacts
Build and deploy your app every time your code changes
Run a pipeline file
Run a diagnostic on Skaffold
Deploy the artifacts
SYNOPSIS
skaffold command [options]
PARAMETERS
-f, --filename
Path to the Skaffold configuration file (e.g., skaffold.yaml). This file defines the build, test, and deploy steps for your application.
--profile
Activates a named configuration profile defined within your skaffold.yaml, allowing for environment-specific settings (e.g., 'dev', 'staging', 'production').
--default-repo
Specifies a default image repository to use for built images when no full repository is specified in the image name. This helps avoid re-tagging images.
--verbosity
Sets the logging level for Skaffold output. Common levels include 'info' (default), 'debug', 'warn', 'error', and 'fatal', providing more or less detail in the console output.
--kube-context
Overrides the default Kubernetes context from your kubeconfig file. This allows you to target a specific Kubernetes cluster without changing your active context.
--port-forward
Used with skaffold dev and skaffold run, this flag controls whether Skaffold should automatically forward ports from your Kubernetes pods to your local machine, making services accessible locally.
--watch-mode
For skaffold dev, specifies how Skaffold watches for file changes. 'poll' (default) periodically checks for changes, while 'event' leverages file system events for faster detection.
DESCRIPTION
Skaffold is a command-line tool that streamlines and accelerates the development of Kubernetes applications. It automates the entire inner development loop, from building and pushing container images to deploying applications to Kubernetes clusters and watching for source code changes. Skaffold integrates with various build tools (like Docker, Jib, Buildpacks) and deployment methods (like kubectl, Helm, Kustomize). Its flagship command, skaffold dev, provides a continuous feedback loop, automatically rebuilding, redeploying, and even syncing files to a running cluster as code changes, significantly reducing the iteration time for developers. It abstracts away much of the boilerplate Kubernetes configuration and commands, allowing developers to focus more on coding and less on infrastructure details.
CAVEATS
Skaffold typically requires a working Kubernetes cluster (local like Minikube/Kind, or remote) and Docker or another compatible container runtime installed and accessible.
The skaffold.yaml configuration can become complex for large, multi-service applications, requiring careful management of dependencies and build/deploy pipelines.
In continuous development mode (skaffold dev), it can consume significant local system resources, especially with many services or rapid code changes that trigger frequent rebuilds and redeployments.
SKAFFOLD COMMANDS OVERVIEW
Skaffold operates through a set of powerful subcommands, each designed for a specific part of the development lifecycle:
skaffold init: Automatically generates a boilerplate skaffold.yaml configuration based on your project structure.
skaffold dev: The core continuous development command; builds, deploys, watches for changes, syncs files, and sets up port forwarding.
skaffold build: Compiles and pushes container images to a registry based on the skaffold.yaml definition.
skaffold deploy: Deploys your application artifacts to the Kubernetes cluster.
skaffold run: Executes a full build and deploy pipeline once, then waits for the application to become ready.
skaffold debug: Enables easy debugging of applications running in Kubernetes, forwarding debug ports.
skaffold delete: Cleans up the deployed Kubernetes resources associated with your Skaffold project.
THE SKAFFOLD.YAML CONFIGURATION FILE
The skaffold.yaml file is the central piece of a Skaffold project. It's a YAML-based manifesto that declares how your application should be built, tested, and deployed to Kubernetes. This file defines:
Artifacts: Descriptions of your application's container images (e.g., Dockerfiles, Jib configurations).
Build Strategies: How images are built (e.g., local Docker daemon, Google Cloud Build).
Test Commands: Commands to run unit or integration tests.
Deployment Methods: How the application is deployed (e.g., using kubectl manifests, Helm charts, Kustomize overlays).
Profiles: Environment-specific configurations that can be activated to change build/deploy behavior. Properly configuring this file is fundamental to leveraging Skaffold's full capabilities.
HISTORY
Skaffold was developed by Google engineers with the primary goal of simplifying the inner development loop for Kubernetes applications. It was first introduced to the public around 2018, aiming to provide a seamless local development experience that integrates with cloud-native workflows. Over time, it has become a widely adopted tool in the cloud-native ecosystem and is part of the Cloud Native Computing Foundation (CNCF) landscape, reflecting its importance in streamlining Kubernetes development.