5. “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 also provides
building blocks and describe customizations
for a CI/CD pipeline.”
6. 2018 2019 2020 2021 2022
V2.0.0
Oct 21, 2022
V1.1.0
Dec 21, 2019
v0.1.0
Mar 6, 2018
2023
V1.39.2
Aug 17,2022
V2.0.2
Nov 15, 2022
Timeline
latest
v0.41.0
Oct 25, 2019
46 Releases
72 Releases
11. Quickstart - Cloud Workstation
Cloud Code
Easier to create apps
in Google Cloud
12. Getting Started With
Your Project
Guides
skaffold dev Debugging With
Skaffold
Continuous Delivery Managing ARM
workloads [NEW]
Guides | Skaffold - https://skaffold.dev/docs/workflows/
13. Guides - skaffold dev
skaffold dev enables continuous local development on an application.
While in dev mode, Skaffold will watch an application’s source files,
and when it detects changes, will rebuild your images (or sync files to
your running containers), push any new images, test built images, and
redeploy the application to your cluster.
File Sync Build Test Deploy
Dev loop
Code Change ?
Yes
14. Guides - skaffold debug
Skaffold lets you set breakpoints and step through your application,
even when deployed to remote Kubernetes clusters, as if the code were
running locally on your machine
● Go 1.13+ (runtime ID: go) using Delve
● NodeJS (runtime ID: nodejs) using the NodeJS Inspector (Chrome
DevTools)
● Java and JVM languages (runtime ID: jvm) using JDWP
● Python 3.5+ (runtime ID: python) using debugpy (Debug Adapter
Protocol) or pydevd
● .NET Core (runtime ID: netcore) using vsdbg (only for VS Code)
18. Guides - Continuous Delivery
Skaffold provides several features and sub-command “building blocks”
that make it very useful for integrating with (or creating entirely new)
CI/CD pipelines.
● skaffold build - build, tag and push artifacts to a registry
● skaffold deploy - deploy built artifacts to a cluster
● skaffold render - export the transformed Kubernetes manifests
● skaffold apply - send hydrated Kubernetes manifests to the API
server to create resources on the target cluster
$ skaffold build -f skaffold-v2.yaml --default-repo gcr.io/gcp-10-mins --file-output build.json
$ skaffold deploy --build-artifacts=./build.json
{"builds":[{"imageName":"square","tag":"gcr.io/gcp-10-mins/square:latest@sha256:665db6a58565ee192093df04470
ea86705d8b33b69c1e7f6d7a6ea07e18491f6"}]}
19. Guides - Continuous Delivery Cont.
Skaffold allows separating the generation of fully-hydrated Kubernetes
manifests from the actual deployment of those manifests, using the
skaffold render and skaffold apply commands.
$ skaffold render -f skaffold-v2.yaml --default-repo gcr.io/gcp-10-mins > render.yaml
$ skaffold render -f skaffold-v2.yaml apply render.yaml
beta
20. Guides - Managing ARM workloads
Skaffold will check the active Kubernetes cluster node architecture and
provide that as an argument to the respective image builder. If the
cluster has multiple architecture nodes, then Skaffold will also create
appropriate Kubernetes affinity rules so that the Kubernetes Pods with
these images are assigned to matching architecture nodes.
New
$ skaffold run -f skaffold-v2.yaml --default-repo gcr.io/gcp-10-mins --cache-artifacts=false
Generating tags...
- square -> gcr.io/gcp-10-mins/square:latest
Starting build...
Building [square]...
Target platforms: [linux/amd64]
v1: Pulling from buildpacks/builder
Digest: sha256:de4d669b82419307072df7b35c3c9a81aca35e308be2bac5ec4ca7dbcba31f24
Status: Image is up to date for gcr.io/buildpacks/builder:v1
GKE Node
25. Release v2.0.0 Release · GoogleContainerTools/skaffold - https://github.com/GoogleContainerTools/skaffold/releases/tag/v2.0.0
Highlights & New Features
● 💻 Support for deploying to ARM, X86 or Multi-Arch K8s clusters from
your x86 or ARM machine
● 👟 New Cloud Run Deployer brings the power of Skaffold to Google
Clouds serverless container runtime
● 📜 Skaffold render phase has been split from deploy phase providing
increased granularity of control for GitOps workflows
● 🚦New Skaffold verify phase enables improved testing capabilities
making Skaffold even better as a CI/CD tool
● ⚙ Tighter integration with kpt lets you more dynamically manage
large amounts of configuration and keep it in sync
26. Upgrading from Skaffold v1 to Skaffold v2 [NEW] | Skaffold - https://skaffold.dev/docs/upgrading/
1. skaffold deploy → skaffold render +
skaffold deploy
2. New schema version: v3alpha1
3. Few skaffold v1 features are no longer
support or require manual changes for
v2.0.0-beta3 include
4. there are currently no known other
regressions when migrating from
skaffold v1 -> v2 but areas that are
most likely to have possible
issues/incompitibility
Upgrading from Skaffold v1 to
Skaffold v2
$ cat skaffold.yaml | head -1
apiVersion: skaffold/v2beta29
$ skaffold fix
apiVersion: skaffold/v3alpha1
kind: Config
build:
artifacts:
- image: skaffold-example
manifests:
rawYaml:
- k8s-*
deploy:
kubectl: {}
27. Init
skaffold init helps you get
started using Skaffold by
running you through a wizard and
generating the required
skaffold.yaml file in the root
of your project directory.
The generated skaffold.yaml
defines your build and deploy
config.
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: '-'
build:
artifacts:
- image: gcr.io/gcp-10-mins/add
buildpacks:
builder: gcr.io/buildpacks/builder:v1
manifests:
helm:
flags:
upgrade:
- --install
releases:
- name: square
chartPath: deployments/square
setValues:
square.image: square
setValueTemplates:
square.env.QS_LOG_LEVEL: "{{.QS_LOG_LEVEL}}"
deploy:
helm:
{}
28. Build
Local Build In Cluster Build Remote on Google Cloud Build
Dockerfile Yes Yes Yes
Jib Maven and Gradle Yes - Yes
Cloud Native Buildpacks Yes - Yes
Bazel Yes - -
ko Yes - Yes
Custom Script Yes Yes -
The build section in the Skaffold configuration file, skaffold.yaml,
controls how artifacts are built. To use a specific tool for building
artifacts, add the value representing the tool and options for using
that tool to the build section.
32. Deploy - Google
Cloud Run alpha
manifests must be valid Cloud
Run services, using the
serving.knative.dev/v1 schema
googleapi: Error 400: Registry
image path like
[region.]gcr.io/repo-path[:tag
and/or @digest]
apiVersion: skaffold/v4beta1
kind: Config
build:
artifacts:
- image: gokit-add-cloud-run
buildpacks:
builder: "gcr.io/buildpacks/builder:v1"
dependencies:
paths:
- cmd/add/main.go
- internal/**
env:
- GOOGLE_BUILDABLE=cmd/add/main.go
tagPolicy:
sha256: {}
local:
push: true
profiles:
- name: cloud-run
manifests:
rawYaml:
- manifests/cloud-run.yaml
deploy:
cloudrun:
projectid: gcp-10-mins
region: asia-east1
New
33. [Skaffold 2.0 Documentation | Skaffold](https://skaffold.dev/docs/)
Deploy - Google Cloud Run Cont.
New
$ skaffold --default-repo gcr.io/gcp-10-mins run -p cloud-run
WARN[0001] failed to detect active kubernetes cluster node platform. Specify the correct build platform in
the `skaffold.yaml` file or using the `--platform` flag subtask=-1 task=DevLoop
Generating tags...
- gokit-add-cloud-run -> gcr.io/gcp-10-mins/gokit-add-cloud-run:latest
....
Build [gokit-add-cloud-run] succeeded
Starting test...
Tags used in deployment:
- gokit-add-cloud-run ->
gcr.io/gcp-10-mins/gokit-add-cloud-run:latest@sha256:acf05cfabd250d6d576e6b0b8aaa1f18ae3fd79d99e16fa1a5a3be
473f6eecb6
Starting deploy...
Deploying Cloud Run service:
gokit-add-cloud-run
gokit-add-cloud-run: Service starting: Deploying Revision. Waiting on revision
gokit-add-cloud-run-00001-wyq.
Cloud Run Service gokit-add-cloud-run finished: Service started. 0/1 deployment(s) still pending
You can also run [skaffold run --tail] to get the logs
34. Deploy - Helm
Update
No more `artifactOverrides` or `imageStrategy`
Skaffold no longer requires the intricate configuring of
artifactOverrides or imageStrategy fields. See docs here on how
old artifactOverrides and imageStrategy values translate to
setValues entires in the latest Skaffold schemas (apiVersion:
skaffold/v3alpha1 or skaffold binary version v2.0.0 onwards)
Note
(manifest.helm.*) and the helm deployer (deploy.helm.*) is the
use of helm template vs helm install
36. Deploy - Helm Cont.
Update
$ QS_LOG_LEVEL=debug skaffold run --default-repo gcr.io/gcp-10-mins -f skaffold-v2.yaml
Generating tags...
- square -> gcr.io/gcp-10-mins/square:latest
Checking cache...
- square: Found Remotely
Starting test...
Tags used in deployment:
- square ->
gcr.io/gcp-10-mins/square:latest@sha256:36ff3a328a97a4ae13937516b697d63fc5d89621d69fba255683acaad6fa5eb0
Starting deploy...
Release "square" has been upgraded. Happy Helming!
NAME: square
LAST DEPLOYED: Tue Nov 29 08:21:19 2022
NAMESPACE: default
STATUS: deployed
REVISION: 4
TEST SUITE: None
Waiting for deployments to stabilize...
- deployment/square: creating container square
- pod/square-59ddb57855-cvt4b: creating container square
- deployment/square is ready.
Deployments stabilized in 11.323 seconds
You can also run [skaffold run --tail] to get the logs
37. Render
New
the Skaffold renderer renders the final Kubernetes manifests: Skaffold
replaces untagged image names in the Kubernetes manifests with the final
tagged image names. It also might go through the extra intermediate step
of expanding templates (for helm) or calculating overlays (for
kustomize)
● rawYaml - use this if you don’t currently use a rendering tool
● helm
● kpt
● kustomize