[MUSIC PLAYING]
DUSTIN KIRKLAND: Hello.
I'm Dustin Kirkland, a product manager at Google,
and your host at KubeCon Copenhagen. I'm joined here
by one of my colleagues, Matt Rickard,
who's a software engineer on Google's container tools team.
Matt, tell us a little bit about scaffold.
MATT RICKARD: Sure.
Skaffold is a developer workflow tool made specifically
for Kubernetes.
It helps you get started with Kubernetes.
It helps you develop your apps on Kubernetes.
And it really targets that inner development workflow
of build and deploy.
And it also utilizes some of the other tools
that we've published on our team, such as Kaniko, which
is are on-cluster build system.
So the idea is that you can use Skaffold to not only build
and deploy, but with your cluster as your only kind
of dependency.
DUSTIN KIRKLAND: Right.
And Skaffold interfaces with other aspects
of Google Kubernetes or Kubernetes in general?
MATT RICKARD: Yeah.
So the Kubernetes API is exactly what we're targeting.
So with Skaffold, it's pluggable in the sense
that you can build and deploy in a variety of ways,
but your cluster is really the only thing that you need.
DUSTIN KIRKLAND: OK.
So a developer writing some code on their MacBook,
walk us through, I just wrote some Ruby
and I want to deploy that to GKE.
MATT RICKARD: Sure.
So you write your code, you write your Dockerfile, which
is your way to describe your container image,
you write some Kubernetes manifest,
which is how you're going to describe your resources
on your Kubernetes cluster.
And then you write the Skaffold yaml file,
which actually just brings both of those
together and gives you the full metadata from source
to deployment.
So Skaffold takes that Skaffold yaml, it will build your image,
it will deploy it.
It will actually introspect your image for all of your source
code dependencies and perform a file watch on that,
so when those files change, it kicks off
that rapid development loop and you're
able to get that native experience, but on a cluster.
DUSTIN KIRKLAND: And then you're cooking with grease.
MATT RICKARD: Then you're cooking with grease.
DUSTIN KIRKLAND: All right.
I understand you have a demo for us.
You want to walk us through this demo?
MATT RICKARD: Sure.
DUSTIN KIRKLAND: All right, let's see it.
MATT RICKARD: Cool.
So here, I'm just in the Getting Started portion of the Skaffold
repository.
You can check this out at googlecontainertools/skaffold.
And what I have here is I have a very basic go program here.
It's just going to print "Hello world!" every second.
I have a Dockerfile that describes it.
So here I'm using a multistage Dockerfile.
You could really use any sort of Dockerfile here that you want.
And then I have a very simple Kubernetes resource definition
here, which is just a pod that deploys
this Getting Started container on my cluster.
If we look a little bit at the Skaffold yaml,
you can see two main parts to it, the first being build.
And we just have a list of artifacts
here, the first being our Skaffold example.
The really cool thing about Skaffold
is that you can deploy multiple images and multiple deployments
at the same time.
So the idea behind that is that in this microservice world,
cloud-native world, your services might be split up
into many different microservices
and you'll need to be developing on multiple
of those at the same time.
So Skaffold supports all sorts of workflows like that.
And then the deploy stanza here is basically just saying,
take all of my Kubernetes manifests and deploy them.
And I'll just go ahead and I'll do a Skaffold dev.
So this is just going to do a build and deploy,
and then perform a watch on the file system dependencies.
So you can see that we're streaming
our logs from our deployed artifacts here.
It's just saying, "Hello world!"
every second.
DUSTIN KIRKLAND: Now, that deployed locally
or that deployed to the cloud?
MATT RICKARD: Yeah, so good question.
So here I'm using a Minikube cluster,
so it's local to my laptop.
But Skaffold works both remotely and on local clusters.
And there are some optimizations that we
make for the local cases where we
don't have to push all the artifacts around,
but the experience is exactly the same.
So now I'm just going to go and change some code here.
I'm going to say, "Hello KubeCon!"
And then I just saved it.
And this will kick off the build and deploy cycle again.
And you can see that we've already redeployed our new pod,
and it's printing out, "Hello KubeCon!"
So you get that really fast inner development
loop for your workflow.
DUSTIN KIRKLAND: That was incredibly, incredibly fast.
MATT RICKARD: So of course, this is a minimal example.
So we're only deploying a very small go binary.
But in practice, it is quite fast.
DUSTIN KIRKLAND: And have you heard
from users using Skaffold for much larger, maybe
real production-type workloads?
MATT RICKARD: Yeah, absolutely.
And in that case, it's still great
for that inner development loop, but we also
have a mode called Skaffold Run.
And so Skaffold Run will just run this
build and deploy pipeline once.
So the idea is that you can call this
from a product such as Google Container Builder, or Jenkins,
or Spinnaker.
And then you can have the same kind of CI/CD workflow
as you have locally.
So that bridges the gap, and users
aren't left on this cliff of having all of these tools
locally, and then having to learn something
else in their CI/CD pipelines.
DUSTIN KIRKLAND: That's superb.
[MUSIC PLAYING]