Deploy
When Skaffold deploys your application, it goes through these steps:
- the Skaffold deployer renders the final Kubernetes manifests: Skaffold replaces untagged image names in the Kubernetes manifests with the final tagged image names. It also might go through the extra intermediate step of expanding templates (for helm) or calculating overlays (for kustomize).
- the Skaffold deployer deploys the final Kubernetes manifests to the cluster
Supported deployers
Skaffold supports the following tools for deploying applications:
The deploy
section in the Skaffold configuration file, skaffold.yaml
,
controls how Skaffold builds artifacts. To use a specific tool for deploying
artifacts, add the value representing the tool and options for using the tool
to the deploy
section.
For a detailed discussion on Skaffold configuration, see Skaffold Concepts and skaffold.yaml References.
Deploying with kubectl
kubectl
is Kubernetes
command-line tool
for deploying and managing
applications on Kubernetes clusters.
Skaffold can work with kubectl
to
deploy artifacts on any Kubernetes cluster, including
Google Kubernetes Engine
clusters and local Minikube clusters.
Configuration
To use kubectl
, add deploy type kubectl
to the deploy
section of
skaffold.yaml
.
The kubectl
type offers the following options:
Option | Description | Default |
---|---|---|
manifests |
the Kubernetes yaml or json manifests. | ["k8s/*.yaml"] |
remoteManifests |
Kubernetes manifests in remote clusters. | [] |
flags |
additional flags passed to kubectl . |
|
flags
section offers the following options:
Option | Description | Default |
---|---|---|
global |
additional flags passed on every command. | [] |
apply |
additional flags passed on creations (kubectl apply ). |
[] |
delete |
additional flags passed on deletions (kubectl delete ). |
[] |
Example
The following deploy
section instructs Skaffold to deploy
artifacts using kubectl
:
deploy:
kubectl:
manifests:
- k8s-*
Note
kubectl CLI must be installed on your machine. Skaffold will not install it. Also, it has to be installed in a version that's compatible with your cluster.Deploying with Helm
helm
is a package manager for Kubernetes that helps you
manage Kubernetes applications. Skaffold can work with Helm by calling its
command-line interface.
Configuration
To use Helm with Skaffold, add deploy type helm
to the deploy
section of skaffold.yaml
.
The helm
type offers the following options:
Option | Description |
---|---|
releases |
Required a list of Helm releases. |
flags |
additional option flags that are passed on the command line to helm . |
Each release
includes the following fields:
Option | Description | Default |
---|---|---|
name |
Required name of the Helm release. |
|
chartPath |
Required path to the Helm chart. |
|
valuesFiles |
paths to the Helm values files. |
[] |
values |
key-value pairs supplementing the Helm values file. |
{} |
namespace |
Kubernetes namespace. |
|
version |
version of the chart. |
|
setValues |
key-value pairs. If present, Skaffold will send --set flag to Helm CLI and append all pairs after the flag. |
{} |
setValueTemplates |
key-value pairs. If present, Skaffold will try to parse the value part of each key-value pair using environment variables in the system, then send --set flag to Helm CLI and append all parsed pairs after the flag. |
{} |
setFiles |
key-value pairs. If present, Skaffold will send --set-file flag to Helm CLI and append all pairs after the flag. |
{} |
wait |
if true , Skaffold will send --wait flag to Helm CLI. |
false |
recreatePods |
if true , Skaffold will send --recreate-pods flag to Helm CLI when upgrading a new version of a chart in subsequent dev loop deploy. |
false |
skipBuildDependencies |
should build dependencies be skipped. | false |
useHelmSecrets |
instructs skaffold to use secrets plugin on deployment. | false |
remote |
specifies whether the chart path is remote, or exists on the host filesystem. remote: true implies skipBuildDependencies: true . |
false |
overrides |
key-value pairs. If present, Skaffold will build a Helm values file that overrides the original and use it to call Helm CLI (--f flag). |
|
packaged |
parameters for packaging helm chart (helm package ). |
|
imageStrategy |
adds image configurations to the Helm values file. |
|
Helm Build Dependencies
The skipBuildDependencies
flag toggles whether depenedencies of the Helm chart are built with the helm dep build
command. This command manipulates files inside the charts
subfolder of the specified Helm chart.
If skipBuildDependencies
is false
then skaffold dev
does not watch the charts
subfolder of the Helm chart, in order to prevent a build loop - the actions of helm dep build
always trigger another build.
If skipBuildDependencies
is true
then skaffold dev
watches all files inside the Helm chart.
Example
The following deploy
section instructs Skaffold to deploy
artifacts using helm
:
deploy:
helm:
releases:
- name: skaffold-helm
chartPath: skaffold-helm
values:
image: gcr.io/k8s-skaffold/skaffold-helm
Note
helm CLI must be installed on your machine. Skaffold will not install it. Also, it has to be installed in a version that's compatible with your cluster.Deploying with kustomize
kustomize
allows Kubernetes
developers to customize raw, template-free YAML files for multiple purposes.
Skaffold can work with kustomize
by calling its command-line interface.
Configuration
To use kustomize with Skaffold, add deploy type kustomize
to the deploy
section of skaffold.yaml
.
The kustomize
type offers the following options:
Option | Description | Default |
---|---|---|
path |
path to Kustomization files. | . |
flags |
additional flags passed to kubectl . |
|
buildArgs |
additional args passed to kustomize build . |
[] |
flags
section offers the following options:
Option | Description | Default |
---|---|---|
global |
additional flags passed on every command. | [] |
apply |
additional flags passed on creations (kubectl apply ). |
[] |
delete |
additional flags passed on deletions (kubectl delete ). |
[] |
Example
The following deploy
section instructs Skaffold to deploy
artifacts using kustomize:
deploy:
kustomize: {}
# The deploy section above is equal to
# deploy:
# kustomize:
# path: "."