Local Cluster

Skaffold can be easily configured to deploy against a cluster hosted locally, most commonly with minikube or Docker Desktop.

The advantage of this setup is that no images need to be pushed, since the local cluster uses images straight from your local docker daemon. It leads to much faster development cycles.

Auto detection

Skaffold’s heuristic to detect local clusters is based on the Kubernetes context name set on kubectl. You can find your the current context name by running:

kubectl config current-context

Skaffold checks for the following context names:

Kubernetes context Local cluster type Notes
docker-desktop Docker Desktop
docker-for-desktop Docker Desktop This context name is deprecated
minikube 1 minikube See 1
kind-(.*) kind This pattern is used by kind >= v0.6.0
(.*)@kind kind This pattern was used by kind < v0.6.0
k3d-(.*) k3d This pattern is used by k3d >= v3.0.0

For any other name, Skaffold assumes that the cluster is remote and that images have to be pushed.

1 Additionally, a Kubernetes context may be considered as minikube even if it’s not named minikube but it’s cluster certificate is stored at $HOME/.minikube or the minikube profile list command returns the Kubernetes context name.

Manual override

For non-standard local setups, such as a custom minikube profile, some extra configuration is necessary. The essential steps are:

  1. Ensure that Skaffold builds the images with the same docker daemon that runs the pods’ containers.

  2. Tell Skaffold to skip pushing images either by configuring

        push: false

    or by marking a Kubernetes context as local (see the following example).

For example, when running minikube with a custom profile (e.g. minikube start -p my-profile):

  1. Set up the docker environment for Skaffold with source <(minikube docker-env -p my-profile). This should set some environment variables for docker (check with env | grep DOCKER). It is important to do this in the same shell where Skaffold is executed.

  2. Tell Skaffold that the Kubernetes context my-profile refers to a local cluster with

    skaffold config set --kube-context my-profile local-cluster true
Last modified November 18, 2021: release v1.35.1 : patch release v1.35.1 (6945c5b)