Easy and Repeatable Kubernetes Development
Clone or download
balopat Merge pull request #1288 from balopat/upgrade_hugo_in_webhook
upgrading hugo + unpinning webhook image
Latest commit e3d808c Nov 17, 2018
Permalink
Failed to load latest commit information.
.github add nkubala to MAINTAINERS (#993) Sep 19, 2018
cmd/skaffold Merge pull request #1282 from nkubala/compose Nov 16, 2018
deploy upgrading hugo + unpinning webhook image Nov 17, 2018
docs added docs Oct 23, 2018
examples Add compose integration test and example (with note). Add kompose to … Nov 15, 2018
hack testing typecheck against 1.11 Nov 15, 2018
installers/brew brew: remove version from formula Jun 28, 2018
integration Add compose integration test and example (with note). Add kompose to … Nov 15, 2018
logo logo: add files Jun 29, 2018
pkg upgrading hugo + unpinning webhook image Nov 17, 2018
testutil Fix error messages Nov 8, 2018
vendor Fix port-forwarding for multiple ports per pod Nov 8, 2018
webhook code review comments Nov 2, 2018
.gcloudignore cloudbuild: fix docs generation + adds testing for GCB triggers (#661) Jun 14, 2018
.gitignore cleaning up generated bazel files from examples Nov 1, 2018
.travis.yml adding go 1.11 to travis matrix Nov 15, 2018
CHANGELOG.md cut v0.18.0 Nov 8, 2018
CONTRIBUTING.md Add DEVELOPMENT.md (#901) Aug 17, 2018
DEVELOPMENT.md fixes `skaffold version` in the released docker image (#933) Aug 29, 2018
Gopkg.lock Fix port-forwarding for multiple ports per pod Nov 8, 2018
Gopkg.toml Ran dep ensure to updated go-github Oct 24, 2018
LICENSE Fixing the licence Jun 8, 2018
MAINTAINERS add nkubala to MAINTAINERS (#993) Sep 19, 2018
Makefile Support system's LDFLAGS, make bin reproducible Nov 14, 2018
README.adoc added docs Oct 23, 2018
appveyor.yml Publish windows binaries on AppVeyor Jun 24, 2018
code-of-conduct.md docs: add code of conduct (#136) Mar 6, 2018
test.sh Fix code style Oct 23, 2018

README.adoc

Skaffold

Build Status
Code Coverage

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

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

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

Demo

Demo

Getting Started with Local Tooling

For getting started with Google Kubernetes Engine and Container Builder go here. Otherwise continue below to get started with a local Kubernetes cluster.

Installation

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

  1. skaffold

  2. Kubernetes Cluster

  3. kubectl

    • If you’re not using Minikube, 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), you can use gcloud and run gcloud auth configure-docker to configure Docker with GCR credentials. If you don’t have gcloud, you can install a standalone helper – docker-credential-gcr.

Iterative Development

  1. Clone this repository to get access to the examples.

    git clone https://github.com/GoogleContainerTools/skaffold
  2. Change directories to the getting-started example.

    cd examples/getting-started
  3. Skaffold needs a repo to push to (unless you are running against a local k8s cluster)

  4. Run skaffold dev --default-repo <your-image-repo>.

    $ skaffold dev --default-repo <your-image-repo>
    Starting build...
    Found [minikube] context, using local docker daemon.
    Sending build context to Docker daemon  6.144kB
    Step 1/5 : FROM golang:1.9.4-alpine3.7
     ---> fb6e10bf973b
    Step 2/5 : WORKDIR /go/src/github.com/GoogleContainerTools/skaffold/examples/getting-started
     ---> Using cache
     ---> e9d19a54595b
    Step 3/5 : CMD ./app
     ---> Using cache
     ---> 154b6512c4d9
    Step 4/5 : COPY main.go .
     ---> Using cache
     ---> e097086e73a7
    Step 5/5 : RUN go build -o app main.go
     ---> Using cache
     ---> 9c4622e8f0e7
    Successfully built 9c4622e8f0e7
    Successfully tagged 930080f0965230e824a79b9e7eccffbd:latest
    Successfully tagged gcr.io/k8s-skaffold/skaffold-example:9c4622e8f0e7b5549a61a503bf73366a9cf7f7512aa8e9d64f3327a3c7fded1b
    Build complete in 657.426821ms
    Starting deploy...
    Deploying k8s-pod.yaml...
    Deploy complete in 173.770268ms
    [getting-started] Hello world!
  5. Skaffold has done the following for you:

    • Build an image from the local source code

    • Tag it with its sha256

    • Sets that image in the Kubernetes manifests defined in skaffold.yaml

    • Deploy the Kubernetes manifests using kubectl apply -f

  6. You will see the output of the pod that was deployed:

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

Now, update 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] Hello jerry!
[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

More examples

Community

There is a bi-weekly Skaffold users meeting at 9:30am-10am PST hosted on hangouts under "skaffold". Everyone is welcome to add suggestions to the agenda and attend. Join the skaffold-users mailing list to get the calendar invite directly on your calendar.