score-k8s

Get started with the score-k8s reference implementation

Overview

The score-k8s CLI serves as a reference implementation for the Score specification, providing a standard for the creation of custom Score CLIs. Score-k8s can be utilized both as a reference point for implementation and for practical use in development with Kubernetes. Below you’ll find an overview of:

For additional details and opportunities to contribute to the project, visit the score-k8s GitHub repository.

Installation

You can install the score-k8s CLI in a variety of ways:

Homebrew

Prerequisites: You must have brew installed.

brew install score-spec/tap/score-k8s

Go

Prerequisites: You must have Go installed.

$ go install -v github.com/score-spec/score-k8s@latest

Manual download

The following methods download the score-k8s CLI from its GitHub release page:

1. Download the latest release from the GitHub release page:

curl -L -o score-k8s.tgz https://github.com/score-spec/score-k8s/releases/download/<x.y.z>/score-k8s_<x.y.z>_<os_system>.tar.gz

2. Unpack the latest release

tar xvzf score-k8s.tgz

The following is the output of the previous command:

x LICENSE
x README.md
x score-k8s

3. Clean up the tar file

rm score-k8s.tgz README.md LICENSE

4. Move the binary to PATH

sudo mv ./score-k8s /usr/local/bin/score-k8s
sudo chown root: /usr/local/bin/score-k8s

You’ve successfully installed the score-k8s CLI!

1. Download the latest release from the GitHub release page:

wget https://github.com/score-spec/score-k8s/releases/download/<x.y.z>/score-k8s_<x.y.z>_<os_system>.tar.gz

You should see something similar to the following output:

Saving to: score-k8s_<x.y.z>_<os_system>.tar.gz

score-k8s_<x.y.z> 100%[===================>]   2.85M  5.28MB/s    in 0.5s

2. Install into your local directory

In your terminal, enter the following to create the score-spec directory.

cd /usr/local/bin/
# create the directory if needed
mkdir -pv score-spec

Extract the compressed Tar file (You may need to run this command with elevated permissions):

tar -xvzf ~/<your-path>/score-k8s_<x.y.z>_<os_system>.tar.gz

You should see the following output:

x LICENSE
x README.md
x score-k8s

3: Export PATH

Future terminal sessions may require you add this path to your ~/.zshrc or ~/.bashrc file, if it isn’t there already.

export PATH=$PATH:/usr/local/bin/

4: Verify installation

score-k8s --version

The command returns the following output:

score-k8s <x.y.z>

You’ve successfully installed the score-k8s CLI!

1. Download the latest compressed Tar file for your operating system from the GitHub release page. By default, the tarball will be saved to your ~/Downloads directory. If you choose to use a different location, you’ll need to change that in the following steps.

score-k8s_x.y.z_osx-amd64.tar.gz

2. Install into your local directory

In your terminal, enter the following to create the score-spec directory.

cd /usr/local/bin/
# create the directory if needed
mkdir -pv score-spec

Extract the compressed Tar file (You may need to run the previous command with elevated permissions).

tar -xvzf ~/Downloads/score-k8s_<x.y.z>_darwin_arm64.tar.gz -C /usr/local/bin/

You should see the following output:

x LICENSE
x README.md
x score-k8s

3. Export PATH

Future terminal sessions may require you add this path to your ~/.zshrc or ~/.bashrc file, if it isn’t there already.

export PATH=$PATH:/usr/local/bin/

4. Verify installation

score-k8s --version

The command returns the following output:

score-k8s x.y.z

You’ve successfully installed the score-k8s CLI!

1. Download the latest release from the GitHub release page.

2. Decompress the zip file, and move the binary to your PATH.

You’ve successfully installed the score-k8s CLI!

CLI Reference

The score-k8s CLI provides a set of commands and flags to enable the generation of Kubernetes manifests from Score specifications.

Commands

init

The init command will prepare the current directory for working with score-k8s and write the initial empty state and default provisioners file into the '.score-k8s' subdirectory. The '.score-k8s' directory contains state that will be used to generate any Kubernetes resource manifests including potentially sensitive data and raw secrets, so this should not be checked into generic source control.

score-k8s init [flags]

Flags

The init command can be combined with the following flags:

--file | -f

Specifies a Score file to initialize. By default this is ./score.yaml.

score-k8s init --file custom_file_name.yaml

--no-sample

Disables the generation of the sample Score file if you already have a Score file in place.

score-k8s init --no-sample

--help | -h

Displays help information for init, providing a short description of the command along with examples and compatible flags.

score-k8s init --help

generate

The generate command will convert Score files in the current Score state into a combined set of Kubernetes manifests. All resources and links between Workloads will be resolved and provisioned as required. score-k8s init must be run first. An error will be thrown if the project directory is not present.

score-k8s generate [flags]

Flags

The generate command can be combined with the following flags:

--image

Specifies an optional container image to use for any container with image == '.'.

score-k8s generate --image your_container_image

--output | -o

Specifies the output file to write the manifest to. By default, the output file is named manifest.yaml.

score-k8s generate --output your_output_file.yaml

--override-property

Specifies an optional set of path=key overrides to set or remove.

score-k8s generate --override-property path1=value1

--overrides-file

Specifies an optional file of Score overrides to merge in.

score-k8s generate score.yaml --overrides-file=./overrides.score.yaml

--patch-manifests

Specifies an optional set of <kind|*>/<name|*>/path=key operations for the output manifests.

score-k8s generate --patch-manifests 'Deployment/my-workload/spec.replicas=3'

--help | -h

Displays help information for generate, providing a short description of the command along with examples and compatible flags.

score-k8s generate --help

help

The help command provides information on all commands.

score-k8s help [command] [flags]

Global flags

--help | -h

Displays help information for score-k8s, includig available commands and flags.

score-k8s --help

--quiet

Mutes any logging output.

score-k8s --quiet

--verbose count | -v

Increases log verbosity and detail by specifying this flag one or more times.

score-k8s --verbose count

--version

Displays the version of score-k8s.

score-k8s --version