Giter Club home page Giter Club logo

skaffold's Introduction

Skaffold

Skaffold is a command line tool that facilitates continuous development for Kubernetes applications. You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters. Skaffold handles the workflow for building, pushing and deploying your application. It can also be used in an automated context such as a CI/CD pipeline to leverage the same workflow and tooling when moving applications to production.

Features

  • No server-side component. No overhead to your cluster.
  • Detect changes in your source code and automatically build/push/deploy.
  • Image tag management. Stop worrying about updating the image tags in Kubernetes manifests to push out changes during development.
  • Supports existing tooling and workflows. Build and deploy APIs make each implementation composable to support many different workflows.
  • Support for multiple application components. Build and deploy only the pieces of your stack that have changed.
  • Deploy regularly when saving files or run one off deployments using the same configuration.

Pluggability

Skaffold has a pluggable architecture that allows you to choose the tools in the developer workflow that work best for you. Plugability Diagram

Operating modes

skaffold dev

Updates your deployed application continually:

  • Watches your source code and the dependencies of your docker images for changes and runs a build and deploy when changes are detected
  • Streams logs from deployed containers
  • Continuous build-deploy loop, only warn on errors

skaffold run

Run runs a Skaffold pipeline once, exits on any errors in the pipeline.
Use for:

  • Continuous integration or continuous deployment pipelines
  • Sanity checking after iterating on your application

Getting Started with Local Tooling

Installation

You will need the following components to get started with Skaffold:

  1. skaffold

    • To download the latest Linux build, run:
      • curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin
    • To download the latest OSX build, run:
      • curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-darwin-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin
  2. Kubernetes Cluster

  3. kubectl

    • Configure the current-context with your target cluster for development
  4. docker

  5. Docker image registry

    • Your docker client should be configured to push to an external docker image repository. If you're using a minikube or Docker for Desktop cluster, you can skip this requirement.
    • If you are using Google Container Registry (GCR), run: gcloud docker -a

Iterative Development

To get started, change the imageName and IMAGE_NAME parameters of examples/getting-started/skaffold.yaml. This should be a fully qualified image name that your docker client is configured to push to.
From the root directory of this repository.

$ skaffold dev -f examples/getting-started/skaffold.yaml
Starting build...
Found minikube or Docker for Desktop context, using local docker daemon.
Sending build context to Docker daemon   7.68kB
Step 1/5 : FROM golang:1.9.4-alpine3.7
 ---> fb6e10bf973b
Step 2/5 : WORKDIR /go/src/github.com/GoogleCloudPlatform/skaffold/examples/getting-started
 ---> Using cache
 ---> 259762612c45
Step 3/5 : CMD ./app
 ---> Using cache
 ---> e2cb5a3e8812
Step 4/5 : COPY main.go .
 ---> Using cache
 ---> 149d709c4fd9
Step 5/5 : RUN go build -o app main.go
 ---> Using cache
 ---> a688409b7e69
Successfully built a688409b7e69
Successfully tagged 97e2a15e650c6470fb30e1cdcc808b59:latest
Successfully tagged changeme:a688409b7e696dec944a36a1fe4063fa7b6726891be75809d4ec8f180e2ccc96
Build complete.
Starting deploy...
Deploying examples/getting-started/k8s-pod.yaml...
Deploy complete.
[getting-started getting-started] Hello world!

At this point, you should be able to see some output from the pod in the Skaffold output:

[getting-started getting-started] Hello world!
[getting-started getting-started] Hello world!
[getting-started getting-started] Hello world!

Now, update examples/getting-started/main.go

diff --git a/examples/getting-started/main.go b/examples/getting-started/main.go
index 64b7bdfc..f95e053d 100644
--- a/examples/getting-started/main.go
+++ b/examples/getting-started/main.go
@@ -7,7 +7,7 @@ import (

 func main() {
        for {
-               fmt.Println("Hello world!")
+               fmt.Println("Hello jerry!")
                time.Sleep(time.Second * 1)
        }
 }

Once you save the file, you should see the pipeline kick off again to redeploy your application:

[getting-started getting-started] Hello jerry!
[getting-started getting-started] Hello jerry!

Run a deployment pipeline once

There may be some cases where you don't want to run build and deploy continuously. To run once, use:

$ skaffold run -f examples/getting-started/skaffold.yaml

Future

  1. Detect application information and create initial deployment manifests
  2. Create pipelines for CI/CD systems to facilitate transitions to production

Community

skaffold's People

Contributors

r2d4 avatar dlorenc avatar dgageot avatar ahmetb avatar

Watchers

James Cloos avatar Tom Le Coney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.