Use Skaffold with Cloud Deploy

This article describes Skaffold, how and why Cloud Deploy uses it, and what you need to do to make it work for you.

Cloud Deploy uses Skaffold for render and deploy operations. You can also use it for local development, build, test, and for advanced deployment features. However, Cloud Deploy requires only a Skaffold configuration that identifies the manifests to render and apply.

What is Skaffold?

Skaffold is a command-line tool that enables continuous development for Kubernetes-native applications. You can use Skaffold to configure a local development workspace to use with Cloud Deploy continuous delivery pipelines.

Skaffold includes the following features:

  • It gives you discrete control of CI/CD pipeline activities (build, render, test deploy, and so on).

  • It's useful as a local development tool.

  • Skaffold profiles let you differentiate among different environments, with different build, test, and deploy configurations, all in the same configuration file.

Why does Cloud Deploy use Skaffold?

Google Cloud Deploy uses Skaffold to separate rendering tools from the delivery pipeline. Your delivery pipeline simply defines the progression from target to target, while your Skaffold configuration defines which manifests are rendered and how. This makes manifest rendering flexible without affecting how you define your delivery pipeline.

Here are some of the advantages that Skaffold provides when you use it with Cloud Deploy:

  • Easy onboarding

    Start with a local development loop. You can share your skaffold.yaml file with your team, which can enable consistency help new team members.

  • Consistent control over rendering across diverse deployment targets

    You can use Skaffold profiles, with different rendering and deployment for different targets.

  • Choice of rendering tools without compromising how delivery pipelines are defined

    Using Skaffold allows Cloud Deploy to separate delivery pipeline definition from render details. This separation lets you experiment with your manifests without disrupting the delivery pipeline.

  • Coherent rendering process

    The rendering source plus your containers are use to generate rendered manifests.

  • Deployment health checks

    Skaffold performs them, and Cloud Deploy uses them.

How does Cloud Deploy use Skaffold?

  • The rendering source and references to container images are passed to Cloud Deploy when you create a release.

    As part of release creation, Cloud Deploy calls Cloud Build, which, in turn, invokes skaffold diagnose and skaffold render to render the manifest or manifests using that rendering source and those images.

  • You can use Skaffold profiles to differentiate manifests that will be applied to different targets.

  • Cloud Deploy supports static Skaffold modules.

  • When deploying, Cloud Deploy calls skaffold apply to apply the rendered manifest or manifests to the target cluster.

  • Cloud Deploy doesn't support the use of other deployers to deploy your application, unless you use custom targets. However, you can use tools like Helm or Kustomize as renderers. To learn more about how Cloud Deploy deploys without using specific deployers (like Helm), see Service architecture.

Make Skaffold work for you

  1. Configure Skaffold according to your pipeline needs.

    1. Determine the needs of your delivery pipeline.

      How many targets will you have? Are rendering and deployment the same for each. If configuration is the same for each target in your progression, you won't need to use Skaffold profiles. You only need a skaffold.yaml file that describes the manifests to render.

    2. If applicable, create a Skaffold profile for each target

      Define this in your skaffold.yaml file and bind in your delivery pipeline definition progression sequence.

      See the Skaffold documentation for more information about Skaffold profiles. Also, the document Managing manifests in Cloud Deploy includes example profile configurations.

  2. Connect Cloud Deploy to your continuous-integration system.

    At the end of your CI process, pass the skaffold.yaml, the rendering source, and the container images to be populated into the rendered manifest.

  3. Optional: set up your local development loop, using Skaffold.

    Using Skaffold for development is optional in Cloud Deploy. The only thing that's required in order for Cloud Deploy to operate is a skaffold.yaml file that identifies manifests to render.

What's next

  • Visit the Skaffold site to find out about how it works and what it can do for you.

  • Learn how Cloud Deploy selects the Skaffold version to use, when the Skaffold version changes, and how to determine which version is currently in use.

  • Learn how to use Skaffold profiles in conjunction with advanced manifest-management tools like Helm, Kustomize, and kpt.

  • Try out the Skaffold profiles walkthrough.