Contents

Skaffold - Installation

 Skaffold is a tool that automates local development workflows and deployments in kubernetes.

Introduction

Creating new microservice applications can be hard when developing for kubernetes. Your services often have dependencies on other APIs that may only exists in the cloud, such as Google Maps. You may see engineers making a change locally, then pushing it to git, running the CI/CD pipeline and finally debugging in the build environment. Only to make a small change and repeat the process again. Where possible one should avoid this lengthy process. Making changes this way produces toil and has a relatively long feedback loop.

In this post, I will be sharing my favorite tool that addresses this issue - skaffold. The tool behind Cloud Code and Google Cloud Deploy. For all of its features please see the skaffold.dev/docs/#features.

In part one, we will be focusing on the tooling required for local development on minikube and initial setup, for part 2 we will focus on skaffold profiles and adding a new application and part 3 for abstraction into helm charts.

Quick Start

 Cookiecutter is a tool that automates project generation.

If you would like to dive right into application development please use the cookiecutter:

  1. Install cookiecutter

    1
    
    pip3 install cookiecutter
    
  2. Generate template

    1
    
    cookiecutter https://github.com/mmcloud/cookiecutter-skaffold-init --checkout v1.0.0
    
  3. Change directory to generated folder (demo directory is default, change according to inputted project slug)

    1
    
    cd demo
    
  4. Start Minikube

    1
    
    minikube start
    
  5. Develop using skaffold or use cloudcode plugin

    1
    
    skaffold dev
    

I prefer cloud plugin and you should see:

/skaffold-installation/cloudcode.png

  1. View services

    1
    
    minikube dashboard
    
  2. Create endpoint

    1
    
    minikube service --url hostservice-external
    
  3. View endpoint

    /skaffold-installation/hostservice.png

Tooling

At the time of writing the following tooling and versions were used

Package Version
skaffold v1.34.0
minikube v1.23.2

Skaffold

Skaffold is described as ‘a command line tool that facilitates continuous development for Kubernetes-native applications. Skaffold handles the workflow for building, pushing, and deploying your application, and provides building blocks for creating CI/CD pipelines. This enables you to focus on iterating on your application locally while Skaffold continuously deploys to your local or remote Kubernetes cluster’.

The key here is the continously deployment to your local or remote kubernets cluster. For installation, please see: skaffold.dev/docs/install/.

The easiest setup requires VScode and is installed when installing the cloud code plugin in VScode. I however will be using the gcloud sdk for quick installation and upgrade.

  1. Install skaffold

    1
    
    gcloud components install skaffold
    
  2. Update skaffold, the default installation doesn’t include the v2beta api. This may change when you are reading this

    Check version

    1
    
    skaffold version
    

    Update Skaffold

    1
    
    gcloud components update skaffold
    

Minikube

Minikube is described as ‘a local Kubernetes, focusing on making it easy to learn and develop for Kubernetes’. With its tunnel feature and addons, it is a personal favorite. There are other options you can look at such as Kind or K3. For installation options, please see: minikube.sigs.k8s.io/docs/start/. Again for ease I will be using the google cloud sdk.

  1. Install minikube

    1
    
    gcloud components install minikube
    
  2. Check minikube version

    1
    
    minikube version
    

Congrats! You are all ready to go, in my next post we will be diving into skaffold’s profiles