Skaffold and Kustomize Setup
- Skaffold
-
The de facto tool for configuring, building, and deploying NGSS applications to Kubernetes clusters. Each project includes a
skaffold.yamlfile that defines how the application is built and deployed across different environments—both local and remote—helping to streamline development, testing, and production workflows. - Kustomize
-
A tool for managing Kubernetes configurations through overlays and patches, enabling declarative resource customization without modifying the original manifests. We use Kustomize to structure and manage environment-specific configurations, ensuring consistency across development, testing, and production deployments.
More information about how we use these tools can be found in the Skaffold & Kustomize section in the Service Development Guide.
Installation
On Mac, you can use brew to install both skaffold and kustomize. If you run into issues, uninstall them from brew and install the versions below.
macOS arm64 (Apple Silicon)
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.16.1/skaffold-darwin-arm64 && \
chmod +x skaffold && sudo mv skaffold /usr/local/bin && \
curl -Lo kustomize.tar.gz "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.7.1/kustomize_v5.7.1_darwin_arm64.tar.gz" && \
tar xvfz kustomize.tar.gz && sudo mv kustomize /usr/local/bin
macOS amd64 (Intel)
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.16.1/skaffold-darwin-amd64 && \
chmod +x skaffold && sudo mv skaffold /usr/local/bin && \
curl -Lo kustomize.tar.gz "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.7.1/kustomize_v5.7.1_darwin_amd64.tar.gz" && \
tar xvfz kustomize.tar.gz && sudo mv kustomize /usr/local/bin
Linux amd64 (Intel)
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.16.1/skaffold-linux-amd64 && \
chmod +x skaffold && sudo mv skaffold /usr/local/bin/skaffold && \
curl -Lo kustomize.tar.gz "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.7.1/kustomize_v5.7.1_linux_amd64.tar.gz" && \
tar xvfz kustomize.tar.gz && sudo mv kustomize /usr/local/bin/kustomize
Windows (PowerShell)
Install Skaffold and Kustomize on Windows using the following steps:
# Create a tools directory on your PATH (adjust as needed)
$tools = "$env:USERPROFILE\bin"
if (!(Test-Path $tools)) { New-Item -ItemType Directory -Path $tools | Out-Null }
# Install skaffold v2.16.1
Invoke-WebRequest -Uri "https://storage.googleapis.com/skaffold/releases/v2.16.1/skaffold-windows-amd64.exe" -OutFile "$tools\skaffold.exe"
# Install kustomize v5.7.1
$zip = "$env:TEMP\kustomize_v5.7.1_windows_amd64.zip"
Invoke-WebRequest -Uri "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.7.1/kustomize_v5.7.1_windows_amd64.zip" -OutFile $zip
Expand-Archive -Path $zip -DestinationPath $env:TEMP -Force
Move-Item -Force -Path (Join-Path $env:TEMP 'kustomize.exe') -Destination (Join-Path $tools 'kustomize.exe')
Write-Host "Ensure $tools is on your PATH, then open a new terminal."
skaffold version
kustomize version
Some tooling in this workflow requires xmllint.exe to be available on your PATH. To install it on Windows:
-
Open https://gitlab.gnome.org/GNOME/libxml2/-/jobs?kind=BUILD
-
Locate the job named
cmake:mingw:w64-x86_64:shared -
Open that job, click on Artifacts, then download the archive
-
Extract the archive contents locally
-
From the extracted
bindirectory, copyxmllint.exeto a directory that is included in yourPATH(for example,C:\Tools\binor another folder already referenced by your environment)
After copying, open a new terminal and verify it resolves by running xmllint --version.
Optionally but highly recommended, install the Gemini Code Assist/Cloud Code (aka Google Cloud Code) for IntelliJ:
Commands
Full Build
The following command runs the full maven build using skaffold, including service standup, integration tests, service teardown and code quality tools:
mvn install -Pwith-skaffold
Running Skaffold During Development
If you are doing active development, we recommend the following options. These should be run from different shells (for example, one in Terminal and one in IntelliJ’s terminal):
skaffold dev
mvn verify -Pskaffold-integration
Both of the above can be done in IntelliJ if you are using the Google Cloud Code plugin. It automatically recognizes skaffold projects, and you can use it to run skaffold dev for you. Then you can run mvn verify -Pskaffold-integration to run tests or manually run the tests within IntelliJ.
|