Learn how to build and deploy Kubernetes applications with Skaffold and customize.
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.
kustomize lets you customize raw, template-free YAML files for multiple purposes, leaving the original YAML untouched and usable as is.
kustomize targets kubernetes; it understands and can patch kubernetes style API objects. It’s like make, in that what it does is declared in a file, and it’s like sed, in that it emits editted text.
On macOS you can install Skaffold with Homebrew.
brew install skaffold
You can find installation instructions for other platforms here: https://github.com/GoogleContainerTools/skaffold/releases
On macOS you can install kustomize with Homebrew.
brew install kustomize
You can find installation instructions for other platforms here: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md
Download Skaffold’s kustomize example
Clone the Skaffold repository and cd into the kustomize example directory.
git clone https://github.com/GoogleContainerTools/skaffoldcd skaffold/examples/kustomize
You can run following command to deploy the application to your Kubernetes cluster.
❯ skaffold runStarting build...Build complete in 41.003µsStarting test...Test complete in 4.239µsStarting deploy...deployment.apps "kustomize-test" createdDeploy complete in 3.548712675sYou can also run [skaffold run --tail] to get the logs
Use skaffold dev to build and deploy your app every time your code changes.
❯ skaffold devStarting build...Build complete in 20.354µsStarting test...Test complete in 3.863µsStarting deploy...deployment.apps "kustomize-test" unchangedDeploy complete in 531.523251msWatching for changes every 1s...
Verify the deployment with kubectl.
❯ kubectl get podsNAME READY STATUS RESTARTS AGEkustomize-test-6557bbc789-7m57b 1/1 Running 0 1m
Clean up and remove the k8s pod.
❯ skaffold deleteCleaning up...deployment.apps "kustomize-test" deletedCleanup complete in 5.754931332s
For our latest insights and updates, follow us on LinkedIn
Koji is CEO and Solutions Architect at Coder Society. With a knack for design and programming, Koji can effectively bridge the gap between these two disciplines in every project. Hands-on mentality and the ability to make quick but well-founded decisions, let him bring new insights into client projects and consultations.