Skaffold

Skaffold is a tool open-sourced by Google to streamline development of local Kubernetes applications. It automates processes like building images, pushing these images and deploying Kubernetes services, making continuous development of Kubernetes applications easier. Its feature highlights include:

  • No server components involved

  • Detection of code changes for automatic build, push, and service deployment

  • Management of image tags

  • Support for existing workflow

  • Deploy upon file saving

Installation

Usage

Before using Skaffold, make sure:

  • The Kubernetes cluster has been deployed and local kubectl command line is configured.

  • The local Docker is running and logged into DockerHub or another Docker Registry.

  • The skaffold command line has been downloaded and placed in the system PATH path.

The Skaffold codebase provides a series of examples. Let's check out a simple one.

Download an example application:

Modify the images in k8s-pod.yaml and skaffold.yaml files by replacing gcr.io/k8s-skaffold with Docker Registry you're logged into. Then, run skaffold

At this point, open another terminal. After you modify the contents of main.go, Skaffold automatically performs

  • Creating a new image (with a unique sha256 TAG)

  • Replacing the image in the k8s-pod.yaml file with the new TAG

  • Redeploying k8s-pod.yaml

最后更新于