GoogleContainerTools/skaffold

Name: skaffold

Owner: GoogleContainerTools

Description: Easy and Repeatable Kubernetes Development

Created: 2018-01-23 18:51:29.0

Updated: 2018-05-24 12:51:45.0

Pushed: 2018-05-24 07:30:39.0

Homepage:

Size: 33645

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Skaffold

Build Status

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
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:

skaffold run

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

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. 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
  3. 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
  4. Kubernetes Cluster

  5. Minikube, GKE, Docker for Mac (Edge) and Docker for Windows (Edge) have been tested but any Kubernetes cluster will work.

  6. kubectl

  7. If you're not using Minikube, configure the current-context with your target cluster for development

  8. docker

  9. Docker image registry

  10. 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.

  11. If you are using Google Container Registry (GCR), choose one of the following:

    1. Use `gcloud`'s Docker credential helper: Run [`gcloud auth configure-docker`](https://cloud.google.com/sdk/gcloud/reference/auth/configure-docker)
    1. Install and configure GCR's standalone cred helper: [`docker-credential-gcr`](https://github.com/GoogleCloudPlatform/docker-credential-gcr#installation-and-usage)
    1. Run `gcloud docker -a` before each development session.
    
Iterative Development
  1. Clone this repository to get access to the examples.

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

    xamples/getting-started
    
  3. Run skaffold dev.

    affold dev
    ting build...
    d [minikube] context, using local docker daemon.
    ing build context to Docker daemon  6.144kB
     1/5 : FROM golang:1.9.4-alpine3.7
    > fb6e10bf973b
     2/5 : WORKDIR /go/src/github.com/GoogleContainerTools/skaffold/examples/getting-started
    > Using cache
    > e9d19a54595b
     3/5 : CMD ./app
    > Using cache
    > 154b6512c4d9
     4/5 : COPY main.go .
    > Using cache
    > e097086e73a7
     5/5 : RUN go build -o app main.go
    > Using cache
    > 9c4622e8f0e7
    essfully built 9c4622e8f0e7
    essfully tagged 930080f0965230e824a79b9e7eccffbd:latest
    essfully tagged gcr.io/k8s-skaffold/skaffold-example:9c4622e8f0e7b5549a61a503bf73366a9cf7f7512aa8e9d64f3327a3c7fded1b
    d complete in 657.426821ms
    ting deploy...
    oying k8s-pod.yaml...
    oy complete in 173.770268ms
    ting-started] Hello world!
    
  4. Skaffold has done the following for you:

  5. Build an image from the local source code

  6. Tag it with its sha256

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

  8. Deploy the Kubernetes manifests using kubectl apply -f

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

    ting-started] Hello world!
    ting-started] Hello world!
    ting-started] Hello world!
    

Now, update main.go

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

c 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:

ting-started] Hello jerry!
ting-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:

affold run
More examples
Community

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.